Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> ORACLE-SQL : Sequence Problem (Need SQL GURUS)
Please advice me on this problem......
I create a sequence say s_mysequence
The sequnce will increment its value by 1.
From my understanding, sequnce will alway increase its value when called.
(Or can we reset the value?).
Here's the problem:
How can I write the code (SQL or PL/SQL or SQL*PLUS)that will increase the
sequence value until it match the value of other parameter value and reset
its value back to 1.
I have to do this since I want my sequnce to be dynamic. Let say I enter parameter 3
My code will generate some number like this
Whatever-Wharever1-A1 Whatever-Wharever1-A2 Whatever-Wharever1-A3
The next run, if I enter parameter 4, using the same sequence (or is there any other way? I don't want to create other new sequence every time) My code will generate some number like this
Whatever-Wharever2-A1 Whatever-Wharever2-A2 Whatever-Wharever2-A3 Whatever-Wharever2-A4
If the sequence is not dynamic and cannot be reset, this is the value I will get
Whatever-Wharever2-A4 Whatever-Wharever2-A5 Whatever-Wharever2-A6 Whatever-Wharever2-A7
Worst to worst, can I reset the sequence number (is it possible?) Can anybody give me some ideas..............PLEASE...............
Newbie,
Norazman
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Wed Sep 09 1998 - 22:34:23 CDT