Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > Create and drop sequence number in a Program Unit

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-03, 13:13
CKENTEBE CKENTEBE is offline
Registered User
 
Join Date: Feb 2003
Location: Toronto, Canada
Posts: 18
Unhappy Create and drop sequence number in a Program Unit

I hope someone can help me here.
--
I have a field in the procedure that should start from 1 at the start of the year. At the end of the year, I want to drop the sequence.
I have to execute the procedure for records every year from 1996 to 2002.
create sequence
procedure(year)
drop sequence

I would appreciate any help here.
Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 02-07-03, 16:15
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 4,874
Re: Create and drop sequence number in a Program Unit

Quote:
Originally posted by CKENTEBE
I hope someone can help me here.
--
I have a field in the procedure that should start from 1 at the start of the year. At the end of the year, I want to drop the sequence.
I have to execute the procedure for records every year from 1996 to 2002.
create sequence
procedure(year)
drop sequence

I would appreciate any help here.
Thanks in advance

BEGIN
EXECUTE IMMEDIATE 'CREATE SEQUENCE myseq';
procedure(year)
EXECUTE IMMEDIATE 'DROP SEQUENCE myseq';
END;
/

Note that the sequence must exist when you create the procedure, otherwise it won't compile (unless you are using dynamic SQL to select).
__________________
Tony Andrews
http://tonyandrews.blogspot.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On