make google dance~
found this link somewhere, it provides a block of javascript that makes images in google image search result dance in a queue, lol funny
http://www3.webng.com/redtophank/cit.html
Achievement provides the only real pleasure in life
found this link somewhere, it provides a block of javascript that makes images in google image search result dance in a queue, lol funny
http://www3.webng.com/redtophank/cit.html
Posted by SF at 9:41 am 0 comments
problem query
select class_schedule.class_id, class_schedule.sum(class_schedule.enrolments) tot_enr, class.name from class_schedule inner join class on class_schedule.class_id = class.id group by class_schedule.class.id
select class_schedule.class_id,
sum(class_schedule.enrolments) tot_enr, class.name
from class_schedule
inner join
class on class_schedule.class_id = class.id
group by class_schedule.class_id, class.name
Posted by SF at 11:01 pm 0 comments
I have this procedure below:
set serveroutput on
DECLARE
v_counter NUMBER(7) := 0;
v_tax NUMBER(11,2) := 0;
v_an_sal NUMBER(11,2) := 0;
CURSOR emp_cursor IS
SELECT id, last_name, first_name, salary
FROM scott.s_emp;
--r_emp scott.s_emp%ROWTYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE(rpad(‘ID’,5) || rpad(‘LAST_NAME’, 15) || rpad(‘FIRST_NAME’,15) || lpad(‘ANNUAL_SALARY’,11) || lpad(‘TAX’,11));
DBMS_OUTPUT.PUT_LINE(rpad(‘____ ’,5) || rpad(‘_______________’, 15) || rpad(‘_______________’,15) || lpad(‘___________’,11) || lpad(‘___________’,11));
FOR r_emp IN emp_cursor LOOP
v_counter := v_counter + 1;
v_tax := 0;
v_an_sal := r_emp.salary * 12;
IF v_an_sal > 150000 THEN
v_tax := 47850 + (v_an_sal -150000)*0.45;
ELSIF v_an_sal > 75000 THEN
v_tax := 17850 + (v_an_sal -75000)*0.40;
ELSIF v_an_sal > 25000 THEN
v_tax := 2850 + (v_an_sal -25000)*0.30;
ELSIF v_an_sal > 6000 THEN
v_tax := (v_an_sal -6000)*0.15;
ELSE
v_tax := 0;
END IF;
DBMS_OUTPUT.PUT_LINE(rpad(r_emp.id,5) || rpad(r_emp.last_name, 15) || rpad(r_emp.first_name,15) || lpad(v_an_sal,11) || lpad(v_tax,11));
IF v_counter mod 5 = 0 THEN
DBMS_OUTPUT.PUT_LINE('******************************************************');
END IF;
END LOOP;
END;
/
Posted by SF at 5:04 pm 0 comments
have this query which returns a set of rows, How can I loop through each row and display them using dbms.output.put_line? Please notice in the where clause there is a variable 'v_trainer_id', the variable value is known (retrieved from a column of a current row of another cursor)
select customer.id as customer_id, membership.join_date, membership.join_fee,round(months_between(sysdate, membership.join_date),0) as months_joined, membership_plan.monthly_price, membership.monthly_discount, (membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0) as total_paidfrom membership,membership_plan,customerwhere membership.membership_plan_id = membership_plan.id andcustomer.id=membership.customer_id andmembership.trainer_id = v_trainer_idorder bycustomer.id;
v_cur_tid := r_trainer.trainer_id;FOR r_mem IN(select membership.customer_id as cust_id, membership.join_date, membership.join_fee,round(months_between(sysdate, membership.join_date),0) as months_joined, membership_plan.monthly_price, membership.monthly_discount, (membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0) as total_paidfrom membership,membership_planwhere membership.membership_plan_id = membership_plan.id andmembership.trainer_id = v_cur_tidorder bymembership.customer_id)LOOP
Posted by SF at 2:01 am 0 comments
I have this part of the stored procedure, trying to use one select query to fill in 2 variables, got error 'PL/SQL: ORA-01744: inappropriate INTO'
--print summary of subsection
select t.* from (select count(membership.id) into v_tot_mem_by_trainer,sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0)) into v_tot_rev_by_trainerfrom membership, membership_planwhere membership.trainer_id = r_trainer.trainer_id andmembership.membership_plan_id = membership_plan.id) t;
select t.* from (select count(membership.id) as total_number_of_members,sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0)) as total_membership_paymentfrom membership, membership_planwhere membership.membership_plan_id = membership_plan.id) t;
select t.* into v_tot_mem_by_trainer, v_tot_rev_by_trainer from (select count(membership.id),sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0))from membership, membership_planwhere membership.trainer_id = r_trainer.trainer_id andmembership.membership_plan_id = membership_plan.id) t;
Posted by SF at 12:47 am 0 comments
I want to select some data from table membership and membership_plan, these 2 have some relationships with each other. In the same query, I also want to 'select count(*) from customers' where customers table has no relationship with the other 2 tables, I just want to find out the total number of customers and display with the rest of the query results.
select (select count(id) from customer), count(membership.id) as total_number_of_members, sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0)) as total_all_members from membership,membership_planwhere membership.membership_plan_id = membership_plan.id;
select (select count(id) from customer), t.* from (select count(membership.id) as total_number_of_members,
sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0)) as total_all_members
from membership, membership_plan
where membership.membership_plan_id = membership_plan.id) t;
Posted by SF at 12:01 am 0 comments
this is my loader ctl file
LOAD DATAINFILE 'trainer.data' BADFILE 'trainer.bad'DISCARDFILE 'trainer.dsc'REPLACEINTO TABLE trainerFIELDS TERMINATED BY ','TRAILING NULLCOLS(ID TERMINATED BY ',' ENCLOSED BY '"',FN TERMINATED BY ',' ENCLOSED BY '"',LN TERMINATED BY ',' ENCLOSED BY '"',GENDER TERMINATED BY ',' ENCLOSED BY '"',PHONE TERMINATED BY ',' ENCLOSED BY '"',MOBILE TERMINATED BY ',' ENCLOSED BY '"',EMAIL TERMINATED BY ',' ENCLOSED BY '"',CERTIFICATE_LEVEL TERMINATED BY ',' ENCLOSED BY '"',IS_PERSONAL_TRAINER TERMINATED BY ',' ENCLOSED BY '"',HIRE_DATE TERMINATED BY ',' ENCLOSED BY '"',IS_ACTIVE ENCLOSED BY '"')
Posted by SF at 2:03 am 0 comments
A tourist walked into a pet shop and was looking at the animals on display. While he was there,another customer walked in and said to the shopkeeper, "I'll have a C monkey please." Theshopkeeper nodded, went over to a cage at the side of the shop and took out a monkey. Hefitted a collar and leash, handed it to the customer, saying, "That'll be £5,000."
The customer paid and walked out with his monkey.
Startled, the tourist went over to the shopkeeper and said, "That was a very expensive monkey. Most of them are only a few hundred pounds. Why did it cost so much?" The shopkeeperanswered, "Ah, that monkey can program in C - very fast, tight code, no bugs, well worth themoney."
The tourist looked at a monkey in another cage. "Hey, that one's even more expensive! £10,000! What does it do?"
"Oh, that one's a C++ monkey; it can manage object-oriented programming, Visual C++, even some Java. All the really useful stuff," said the shopkeeper.
The tourist looked around for a little longer and saw a third monkey in a cage of its own. The price tag around its neck read £50,000. The tourist gasped to the shopkeeper, "That one costs more than all the others put together! What on earth does it do?"
The shopkeeper replied, "Well, I haven't actually seen it do anything, but it says it's a project manager".
Posted by SF at 10:19 am 0 comments
select chr(121 - 11 * (round(dbms_random.value))) is_successful from dual
or
select case when dbms_random.value(0,1) < 0.5 then 'y' else 'n' end is_successful from dual
select translate(dbms_random.string('U',1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','ynynynynynynynynynynynynyn') from dual
select distinct First_Value(is_successful) over(order by dbms_random.value) as is_successfulfrom (select 'n' as is_successful from dual union all select 'y' from dual);
substr('yn', dbms_random.value(1,3), 1)
Posted by SF at 12:30 pm 0 comments
select dbms_random.string('l',dbms_random.value(0,100)) from dual
Posted by SF at 8:34 pm 0 comments
select level num from dual connect by level <= 5;
Posted by SF at 7:27 pm 0 comments
I have a query:
select id from class_schedule where id not in (select distinct(event_id) from trainer_schedule)
randomID :=
select id from
(
select id from class_schedule
where id not in (select distinct(event_id) from trainer_schedule)
order by dbms_random.value
)
where rownum = 1
Posted by SF at 12:20 am 0 comments
e.g.
update membership
set membership.join_fee = (select membership_plan.join_fee
from membership_plan
where membership.membership_plan_id = membership_plan.id)
where exists (select 1
from membership_plan
where membership.membership_plan_id = membership_plan.id)
Posted by SF at 2:15 am 0 comments
Tried to execute the script below got error The query:
DECLARE
CURSOR sol_cursor IS select * from membership;
months NUMBER(5,0) :=0;
BEGIN
FOR r_sol IN sol_cursor LOOP
months := (select min_months from membership_plan where id = r_sol.membership_plan_id);
UPDATE membership
SET end_date = add_months(r_sol.end_date,months)
WHERE id = r_sol.id
END LOOP;
END;
ORA-06550: line 6, column 12: PLS-00103: Encountered the symbol "SELECT" when expecting one of the following: ( - + case mod new not null othersavg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date pipe
Posted by SF at 2:11 am 0 comments
select to_char(to_date('15-08-2006 21:30','DD-MM-YYYY HH24:Mi')+1/24,'DD-MM-YYYY HH24:Mi') from dual
or
select sysdate, sysdate + 5/24 from dual;
Posted by SF at 2:07 am 0 comments
update class_schedule set start_time= add_months(start_time, -12*
(select to_number(to_char(start_time,'yyyy')-2006) from dual)) where
to_char(start_time,'yyyy')> to_char(2006)
GOOD LUCK!
Posted by SF at 2:02 am 0 comments
update class_schedule set start_time = (select add_months(start_time,12*2003)from dual)
or
add_months(trunc(start_time),12*35)
Posted by SF at 1:16 am 0 comments
update class_schedule set start_time = to_date('2003-06-13 15:18','YYYY-MM-DD HH24:MI') where id=17
select to_char(start_time,'YYYY-MM-DD HH24:MI') from class_schedule where id=17;
Posted by SF at 12:08 am 0 comments
SELECT TO_CHAR(TO_DATE('2006-06-06', 'YYYY-MM-DD'), 'J') FROM DUAL;
--> 2453893
SELECT TO_CHAR(TO_DATE('2007-10-01', 'YYYY-MM-DD'), 'J') FROM DUAL;
--> 2454375
SELECT TO_DATE(TRUNC(DBMS_RANDOM.VALUE(2453893, 2454375)), 'J') FROM DUAL;
--> 19/SEP/06
Posted by SF at 7:40 pm 0 comments
UPDATE purchase_order_line
SET discount_total = (select round(dbms_random.value(0, 9999.22),2) from dual)
WHERE purchase_order_id = r_po.purchase_order_id;
Posted by SF at 3:43 am 0 comments
CONSTRAINT "CUSTOMER_CK_PHONE" CHECK (REGEXP_LIKE ( phone, '^([0-9]*?\ ?\/?[0-9]{4}[0-9]{4})$ ' ) ) ENABLE
Posted by SF at 10:09 pm 0 comments
symptom:
I installed 10g ex a while ago, now try to login, but forgot what the password was for the default username "system", can any one please help to retrieve the password?
fix:
SQL> conn / as sysdba
Connected.
SQL> alter user system identified by
Posted by SF at 11:28 pm 0 comments
for the header row, do this:
DBMS_OUTPUT.PUT_LINE(rpad(‘ID’,5) || rpad(‘LAST_NAME’, 15) || rpad(‘FIRST_NAME’,15) || lpad(‘ANNUAL_SALARY’,11) || lpad(‘TAX’,11) || lpad(‘COMMISSION_PCT’, 16));
DBMS_OUTPUT.PUT_LINE(rpad(‘____ ’,5) || rpad(‘_______________’, 15) || rpad(‘_______________’,15) || lpad(‘___________’,11) || lpad(‘___________’,11) || lpad(‘______________’, 16));
then in the loop I did:
DBMS_OUTPUT.PUT_LINE(rpad(r_emp.id,5) || rpad(r_emp.last_name, 15) || rpad(r_emp.first_name,15) || lpad(v_an_sal,11) || lpad(v_tax,11) || lpad(v_com_pct, 16));
not very enjoyable way of formating, but it worked......
Posted by SF at 9:10 pm 0 comments
select * from user_indexes
where table_owner like 'xxxxxx' and table_name like 'ABC';
Posted by SF at 8:29 pm 0 comments
found this tool that makes it easier to upload sql database to the host environment
http://www.codeplex.com/sqlhost
Posted by SF at 4:58 pm 0 comments
select TABLE_NAME, CONSTRAINT_NAME, STATUS
from USER_CONSTRAINTS
where TABLE_NAME like 'INVOICE';
the word after 'like' must be in capital, otherwise you won't get any result
Posted by SF at 10:39 pm 0 comments
create a homepage skin with the LogoPane instead of the Logo skin token
all other pages will use a skin that has standard Logo skin token
Posted by SF at 10:19 pm 0 comments
the background color of my site is mainly dark-red and black, the text is in white color. When i click on a link to open another page, the background always flash in yellow color and return back to normal. what happened?
answer:
there is a background color set to be yellow in the css, check it
Posted by SF at 10:16 pm 0 comments
update DNN site from version 3.1 to 3.3.7, now when i open the site in IE7, the version number is displayed together with the page title on the IE7 tab:
My Site > Home (DNN 3.3.7)
in order to get rid of the stuff in '()', Log in as superuser ("host"), go to host settings in host menu and uncheck "show copyright credits".
Posted by SF at 10:14 pm 0 comments
Only the text with quotes is case sensitive.
Posted by SF at 10:10 am 0 comments
CREATE TABLE student(
student_no NUMBER(3) NOT NULL,
age NUMBER(2) CHECK(age>18),
gender CHAR(1) CHECK(gender='m' or gender='f') NOT NULL
);
Posted by SF at 10:26 am 0 comments
SELECT * FROM tab;
Posted by SF at 2:42 pm 0 comments
select column_name from information_schema.columns where table_name ='authors'
Posted by SF at 2:42 pm 0 comments
select * from sysobjects where type = 'U' and uid=user_id('dbo')
Posted by SF at 2:22 pm 0 comments
SELECT * FROM tab;
Posted by SF at 11:39 pm 0 comments
< asp:Button runat="server" ID="GoButton" Text="Go" CommandName="Select" Visible='<%# ((System.Data.DataRowView)Container.DataItem)["ABC"] != DBNull.Value %/>' />
Posted by SF at 9:59 am 0 comments
if you want to do assign a NULL value to a integer type column, u will get error, I had to try to give a -1 value to work around, is there a better/real solution?
Posted by SF at 3:42 pm 0 comments
tried to format date boundfield to {0:dd/MM/YYYY}, it won't work, in order to solve the problem, you need to set the "HtmlEncode" of the column to "false"
Posted by SF at 3:54 pm 0 comments
normally when i create a table adapter in design view, i will have this list on the last step
Generated SELECT statement.
Generated INSERT statement.
Generated UPDATE statement.
Generated DELETE statement.
Generated table mappings.
Generated Get method.
Generated Update methods.
How come when i use Authors Table in Pubs sample database to create a table adapter, the line "Generated DELETE statement." is missing? (which means that the delete statement wasnt generated)
It is because:
there was no PK set in the author table when i took it out of the Pub database
now with a defined PK (the AuthorID), all the statements were generated correctly.
The designer just didn't provide enough information explaning why some of the statements havn't been generated. maybe it's something need to be improved....
Posted by SF at 2:15 pm 0 comments
I went on to the http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=1425 downloaded the toolkit, but no idea how to installed.
this is the place where i found the solution, hope it can help you too http://ajax.asp.net/ajaxtoolkit/Walkthrough/Setup.aspx
Posted by SF at 2:57 pm 0 comments
Posted by SF at 11:50 am 0 comments
i need to write up a research proposal this semester, what are the hot topics related to information systems at the moment? hope someone can help me out~
Posted by SF at 1:05 pm 0 comments
Posted by SF at 1:33 am 0 comments
TinyMCE
http://tinymce.moxiecode.com/
http://rorlach.de/mediawiki/index.php/PHP
Rich Text Editor
http://www.websitescreation.ca/Products/RichText.php
Posted by SF at 5:20 pm 0 comments