Home » SQL & PL/SQL » SQL & PL/SQL » Help req urgent..!!
Help req urgent..!! [message #3176] Tue, 10 September 2002 22:00 Go to next message
Gilbey
Messages: 87
Registered: March 2002
Member
Though this procedure is executing but it is not inserting the values.Could anyone please tell me the reason.Thanks is advance.
SQL> ed
Wrote file afiedt.buf

1 create or replace procedure scenario1(v_cntryid in varchar2,v_trackingno in varchar2)
2 is
3 cursor cur (c_code varchar2) is select distinct formula_text
4 from lcs_hts
5 where country_id=v_cntryid and
6 tracking_no=v_trackingno and
7 substr(hts_chapter_no,1,2)=c_code;
8 v_text lcs_hts.formula_text%type;
9 i number(3);
10 j varchar2(3);
11 begin
12 for i in 1..99
13 loop
14 j:=to_char(i,'00');
15 open cur('j');
16 loop
17 fetch cur into v_text;
18 exit when cur%notfound;
19 insert into f_text values(j,v_text);
21 end loop;
22 close cur;
23 end loop;
24* end;
25 /

Gilbey
Re: Help req urgent..!! [message #3179 is a reply to message #3176] Wed, 11 September 2002 00:16 Go to previous messageGo to next message
Keith
Messages: 88
Registered: March 2000
Member
I don't think your insert statement is valid. According to the Oracle docs:

Although you can retrieve entire records, you cannot insert or update them. For example, the following statement is illegal:

INSERT INTO dept VALUES (dept_rec); -- illegal

So, you'll have to split up the v_text TYPE when you do the insert.

keith
Re: Help req urgent..!! [message #3186 is a reply to message #3176] Wed, 11 September 2002 06:51 Go to previous message
Balaji
Messages: 102
Registered: October 2000
Senior Member
are u sure the cursor fetches some rows ?.
the insertion wont happen if cursor returns no rows.

balaji
Previous Topic: problem in finding least value
Next Topic: how to know months between two given dates
Goto Forum:
  


Current Time: Tue May 14 15:25:44 CDT 2024