Home » SQL & PL/SQL » SQL & PL/SQL » Oracle and PL/SQL Help
Oracle and PL/SQL Help [message #8073] Thu, 24 July 2003 12:42 Go to next message
Nazma Bepat
Messages: 34
Registered: May 2003
Member
I have created a table with the following information:

Create table nazma
( STUDENT_ID number(6)
, F_NAME varchar2(20)
, L_NAME varchar2(20)
, ADDRESS varchar2(45)
, ZIPCODE number(7)
, PHONE number(8));
The field length can be altered as per requirement.
Sequence can be created as :-
CREATE SEQUENCE seqno
INCREMENT BY 1
START WITH 1000
;
insert into nazma values(seqno.currval,'mehnaz','ahmed','Dubai',34005,679800);
this will insert one record into the table.
similarly you can do for the next four records

I am looking to see if someone would like to help me to create an explicit cursor based on the table above. Include your lastname as part of the cursor name. The cursor should retrieve the lastname and firstname of the student with the id of 1000. Display your output using the DBMS_OUTPUT.PUT_LINE statement.
Re: Oracle and PL/SQL Help [message #8076 is a reply to message #8073] Thu, 24 July 2003 22:27 Go to previous messageGo to next message
amit zhankar
Messages: 31
Registered: March 2003
Member
declare
cursor c1 is select f_name.l_name from nazma where
student_id = 1000;
begin
for i in c1
loop
dbms_output.put_line(i.f_name ||' '||i.l_name);
end Loop;
end;
/
You can use this code
Thanks for your help! [message #8095 is a reply to message #8076] Sat, 26 July 2003 05:54 Go to previous message
Nazma Bepat
Messages: 34
Registered: May 2003
Member
Thanks for your help, I really appreciate it.

Nazma
Previous Topic: hierarchical probs
Next Topic: database link error
Goto Forum:
  


Current Time: Fri Mar 29 06:23:27 CDT 2024