-
Hi Freinds
I am getting one problem.
I have a sequence i.e seq_id, When I use that sequence in two columns in a same query it is returning me the same result.
select seq_id.nextval,seq_id.nextval from dual;
it is returing me the same result in both the columns. can you please tell me why it is happening?
its urgent
Thanks
Shialendra
-
Hi,
You must use seq_id.nextval in each statement:
set serveroutput on;
declare
s1 number;
s2 number;
begin
select seq_id.nextval into s1 from dual;
select seq_id.nextval into s2 from dual;
dbms_output.put_line(s1);
dbms_output.put_line(s2);
end;
/
output:
3
4
cheers,
r.
-
That's normal and expected behaviour.
Sanjay
-
but why it is like that what is the reason?
thanks
Shailendra
-
itīs a variable
itīs like i declare a variable and do
select x, x from dual;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|