Re: cursor

From: Stephen Bell <stephen.bell_at_cgi.ca>
Date: Sat, 21 Jul 2001 21:22:16 GMT
Message-ID: <3B24F2C2.9B2384CC_at_cgi.ca>


Hi,

Since your cursor fetches only one value, what if you just select it into a variable? You're trying to "add" to a cursor..

E.g.
declare a variable

CRSR NUMBER; Then..

BEGIN
select max(serial) into crsr
from A_table;
crsr := crsr + 1;

Then insert....

Zhiliang Hu wrote:

> Thanks to those who answered my previous question!
> I made following trigger to be used when data is loaded with
> sqlloader but got a Warning upon its creation:
>
> ---------------------------------------
> create trigger atest
> after insert or update of serial on A_table
> for each row
> declare
> cursor crsr is (select max(serial) from A_table
> where itemname like 'Old%');
> begin
> crsr=crsr+1;
> insert into A_table (serial) values ('crsr')
> where itemname like 'Old%');
> end;
> /
>
> Warning: Trigger created with compilation errors.
> ---------------------------------------
> Surely upon test it complains:
> "trigger 'ATEST' is invalid and failed re-validation"
>
> Could someone kindly spot where is the problem?
>
> Thanks in advance!
>
> Zhiliang
  Received on Sat Jul 21 2001 - 23:22:16 CEST

Original text of this message