Re: ORACLE-SQL : Sequence Problem (Need SQL GURUS)

From: maiko overgaauw <maikoo_at_worldonline.nl>
Date: 1998/09/10
Message-ID: <35f78f11.12652114_at_news.minvenw.nl>#1/1


Use a sequence for the first number (before the A) use a function (with parameter p) which looks in your table if the maximum value is equal to p. if so then return letter+1 and the first number (1).

I know this is a little bit cryptic, but if you have any questions please feel free to e-mail me.

Good luck and greetings,

Maiko

On Thu, 10 Sep 1998 03:37:14 GMT, azhan98_at_tm.net.my wrote:

>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 Thu Sep 10 1998 - 00:00:00 CEST

Original text of this message