Create sequence start with variable

Trying to create a sequence within plsql passing a variable into the start with clause. I am getting the 'ora-01722: invalid number' error. Thoughts?
-- Created on 06-Jun-07 by CARSONBC
declare
-- Local variables here
v_staff_proxy_user_seq_num number;
begin
-- find max value
select max(staff_proxy_user_id)+1
into v_staff_proxy_user_seq_num
from icmr32dv.staff_proxy_user;
-- create sequence
execute immediate 'create sequence icmr32dv.staff_proxy_user_seq2 minvalue 1 maxvalue 999999999999999999999999999 start with v_staff_proxy_user_seq_num increment by 1 nocache';
end;

What is the requirement of creating sequnce dynamically.?
may be you can try this?
execute immediate 'create sequence icmr32dv.staff_proxy_user_seq2 minvalue 1 maxvalue 999999999999999999 start With  '|| v_staff_proxy_user_seq_num || '  increment by 1 nocache';

Similar Messages

  • How to have a sequence start with specific number in mapping

    Hi,
    I can not find a way in the mapping to specify the "start with" attribute for sequence. Currently I have to execute this from sqlplus; select max(id) from tableA, then create sequence start with max(id)+1. I would like to integrate this step into owb. I'm using 9ir2. Thanks.

    You can do this from a stored procedure that you invoke from your pre-mapping trigger:
    - Scan the source and get the max_id
    - execute immediate 'drop sequence; create sequence ... start with '||max_id+1
    Etc.
    Good luck, Erik Ykema

  • Restrict this transaction code only to create sets starting with 'ZMR'

    Hello,
    I need to create custom transaction code for 'GS01' and restrict this transaction code only to create sets starting with 'ZMR' No other sets should be allowed to be created.
    If anyone have done before with the same scenario. Please give me clear documentation on this .
    Reagdrs
    Kiran

    YOu cannot find the call to the badi's by searching the main program.
    The badi is called a t run time.
    To find a badi attached to a main program, goto se38,
    GIve the program name.
    Goto->Object Directory Entry. Find the package.
    Go to se18 transaction, Press f4.
    give the package name in the popup.
    you can get the badis associated with the main program.
    Regards,
    Ravi

  • Create Sequence Number with Select Query

    Hi All,
    I would like to create a sequence number in oracle but instead of hard coding the "start with" I want to select the max value of the primary key of a table and add 1 and use this instead:
    So what I want is:
    CREATE SEQUENCE crg_mrec_seq
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    START WITH select max(primarykey)+1 from table1
    INCREMENT BY 1
    CACHE 20;I'm guessing I need to pass this max value as a variable into the create sequence number but I'm not sure what syntax to use.
    Thanks,
    Ed

    spalato76 wrote:
    Hi All,
    I would like to create a sequence number in oracle but instead of hard coding the "start with" I want to select the max value of the primary key of a table and add 1 and use this instead:
    So what I want is:
    CREATE SEQUENCE crg_mrec_seq
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    START WITH select max(primarykey)+1 from table1
    INCREMENT BY 1
    CACHE 20;I'm guessing I need to pass this max value as a variable into the create sequence number but I'm not sure what syntax to use.
    Thanks,
    Edconstruct SQL statement & then EXECUTE IMMEDIATE

  • Sequence starting with specific number

    Hi,
    Is it not possible to create a sequence in ODI starting with a specific number. An example is such as a sequence starting from 10,000 and incrementing by 1.
    The reason I am asking is because , in the ODI sequence tab, although there is an option for specifying increment factor, there is no place to mention the first element
    of the sequence.
    Kindly suggest.

    Hi,
    Its not recommend to use ODI sequence as it needs to follow some process for implementation, its advisable to use DB sequence for surrogate columns.
    So please use DB sequence and call it in ODI mapping using the below syntax,
    <SCHEMA_NAME>.<SEQUENCE_NAME>.NEXTVAL
    FYR: http://odiexperts.com/odi-sequence
    Thanks,
    Guru

  • Can i create sequences padded with 0's in the beginning, for e.g. 00500

    Hi,
    If i want to create a sequence starting from 00500 to 99999, how can i do that?
    Please note the sequence should start with 00500 and not 500. I tried creating one, but 00500 got converted to 500.

    SQL> with t as
      2  (select 100 c1 from dual union all
      3  select 1000 from dual)
      4  select lpad(to_char(c1),5,'0')
      5  from t;
    LPAD(                                                                          
    00100                                                                          
    01000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to create a array with variables dimensions?

    I try to create a array like that:
    Object[][] data;
    data = new Object[] [];
    But that's doesn't work!
    Apparently I must specify the dimension of my array
    So I have done like that :
    Object[][] data;
    data = new Object[3] [3];
    And that work!
    But the problem is when I need to add extra elements to my array.
    If I write :
    data[4][1] = "123";
    I have the error message :
    java.lang.ArrayIndexOutOfBoundsException
    So, how can I defined a array with variables dimensions OR how can I add a dimension to a array?

    if you have:
    Object[][] data;
    data = new Object[3] [3];you end yo getting ArrayIndexOutOfBoundException if you try to point to some other Indexes. You can increase the size by doing new:
    Object[][] data;
    data = new Object[4] [3];and then copy the old Arrays to this one... this is heavy.
    Other thing to consider then is using some other datastructure, such as Vector, which grows along you add elements to it.
    P_trg

  • Not allowing to create field starting with underscore and numbers

    Hi All
    I'm trying to create a datatype in PI 7.1 with element starting with underscore and numbers like _Name , 1.0.Name. when I'm trying to activate the dataype. I'm getting the error Activation of the change list canceled.please help me out
    Thanks in advance.

    What exactly are you viewing in production - a data type? You could be viewing an external message. Reconfirm.
    rgds
    gab

  • Temporary tables are getting created, name starting  with BIN$.....

    Hi,
    I am using Oracle 10.2 and am experiencing an issue that doing some operations on existing tables, some temporary tables are getting created starting with BIN$.
    For ex: BIN$HULdSlmnRZmbCXAl/pkA9w==$0
    But I dont see these tables in the database after two or three days. I found that these temporary tables are a replica of existing tables and these contain only the table structure but not the data. I even not able to drop them from database.
    Can anyone throw some pointers on this?
    Thanks and Regards,
    Siva

    These tables are in the Oracle recycle bin. When you drop a table, Oracle just renames it to BIN$xxx so that you can undrop the table if you made a mistake.
    - You can ignore tables in the recycle bin if you would like. Oracle will automatically purge them when it needs the space.
    - You can prevent a table from going in to the recycle bin by adding the purge command to the drop, i.e.
    DROP TABLE table_name PURGE- You can empty out the recycle bin using the command
    SQL> purge dba_recyclebin(or just recyclebin if you only want to clear out the objects you own from the recyclebin).
    Justin

  • Creating user starting with a numeric

    Hi,
    When I try to create a user like 1234a, identified by pwd, it is not allowing me to do that. Is there any kind of setting which prevent the user from creating a user like that.If I do a "1234a" it takes that and when I login I have to say "1234a".
    Appreciate your help
    Vinod

    U can't create a user starting with a numeric value. But as u mentioned
    we can create it like "123". But I dont think while connecting we have to mention it as "123". Instead you can connect as 123.

  • Request start with variable duration

    Hello All expert,
    i got one requirement that different plant want different request start duration after WF created.
    but i saw in WF it is a fixed value to input.Is there anyway to let it be variable?

    Hi Joshua
    the approach Murali mentioned is better to troubleshoot and maintain later on. Using Program Exits and troubleshooting them is a pain in the long run. Program Exits should only be used for STATUS based secondary processings.
    Best is to create an activity step with input as plant and output as Requested Start date and time. Within that step's code you can use the same code to read the config which you were planning to do in the program exit.
    Once you have the requested start date and time in the workflow container, you can use those container variables in the deadline monitoring of the subsequent step.
    Regards,
    Modak

  • How do I create an array with variables also splits words  in a txtfile?

    Hello guys,
    I made a script that reads a text file.
    function readMyFile()
    var myFile=File(app.activeDocument.filePath + "/LareLog.txt");
    if (myFile.exists)
            myFile.open("r");
            var Temps =  myFile.read();
            alert (Temps);                          // message the content
            var nyRad=("\n");                    // break the line
            textArr=Temps.split(nyRad);
            alert(textArr);                          // message the content with all info on new lines ("\n");
            myFile.close();
    my textfile contains:
    ~/Desktop/3.indd ,Thu Mar 20, 2014, 11:26:34 , GMT+0100
    I wonder how do I sort the content in array
    in this order, also creates variables for each string.
    var= string 1[~/Desktop/3.indd]
    var2=string 2[11:26:34]
    var3=string 3[11:26:34]
    var4=string 4[2014]
    var5=string 5 [GMT+0100]
    Thank you in advance people.

    Hmmh?
    Jump_Over said it before: „… are stored as separate array's elements …“ in your [textArr]
    So you can create now variables on this way:
    var string_1 = textArr[0]; // and so on
    alert(string_1);
    See Java Scripting reference for more examples how to use Arrays.

  • Creating materialized view with variables - help

    Greetings,
    I want to create an materialized view (MV) from the external public db link. Below is my full query:
    CREATE MATERIALIZED VIEW PROJECTS_MV
    REFRESH WITH ROWID
    AS
    SELECT prj.Project_id, prj.desc,
    prj.parent_project_id, f_year, f_month
    FROM sysadm.prj@EFUYEEDW_DB_LINK.MSDB prj
    WHERE prj.pf_scenario_id = '708KDD'
    AND prj.ph_id = 'SHAREDP'
    AND f_year = (SELECT EXTRACT(year FROM current_DATE) FROM dual)
    AND f_month = (SELECT EXTRACT(month FROM current_DATE) FROM dual)
    Question: In the query there are two variables that capture the month and year and requery it. Does the data get updated automatically when a new month or new year changes?
    If there is a change, how would I change so it would update the data accordingly?
    Thanks for your help
    john9569

    Hi Christian,
    Thanks for your response. Your codes return the date as 01-JAN-09 which is not what I'm looking for. Maybe my question is not clear.
    So far, the MV is executed correctly what I want. My concern is when it updates the MV, does it get the new data (f_month & f_year) when the MV is updated automatically?
    Other words, the MV is updated nightly to get the incremental data from the db link. Once it passes to the new month, I am not sure how this MV handles since the f_month is now changed to differrent number.
    Thanks for your help.
    Bests,
    John9569

  • Render tiff sequence starting with comp frame# in adobe media encoder?

    Hi
    Does anybody know how to render out a tiff sequence with AME using an after fx comp where the tiff frame numbering generated by AME reflects the same frame numbering in an After fx comp? so if my work area bar in AE comp starts at frame 73 then the first tiff frame rendered out of AME starts at frame 73. at present it seems to always start at 0 which is no good because i then have to renumber all the frames to ensure they replace the correct frames in the image sequence. i already know how to do this rendering directly out of AE. however its nice using AME because you can continue to work in AE while AME runs in the background.
    cheers!
    angus 

    Unfortunately you cannot specify a start file number.
    That would make a good feature request.
    Cheers
    Eddie

  • HP Officejet 8600 scan - How to force scan number sequence starting with a number of my choice

    Using HP Officejet 86XX on WIn7 - with ADF. 
    I scan a lot of docs via the ADF and all docs scanned has a number in sequence noted at the documents.
    Is there any way to decide which number the HP scan software shall start its numbered sequence? Eg. prefix "Document-" and then force the sequence-number to start at 00200, on order for the next file sequence number to be 00201 and then 00202 and so on??

    Hi , I may be able to help you with your scan settings, but I want to make sure I understand what you are trying to accomplish - so let me know if this isn't what you are looking for. Click on the HP Printer Assistant icon on your desktop (It will look like your printer, and be labeled to match)In the HP Printer Assistant click on Scan a Document or PhotoChoose the shortcut you are selecting on the front panel of the printer (ie Save as PDF)Click on Advanced Settings You can modify your scanner settings, I believe you want to change the settings on the Destination tab.Base File Name: First part of the file name, so in your example "Document-", the scanner will automatically number it after each scan.. eg. Document-0001 will be your first scan, Document-0002, will be the second.Save Location: You can even setup a new folder for the scans  After you change the settings, try the scan from the front panel of your printer. Please let me know if these steps resolved your issue, or if there is anything else I can do to help.  I look forward to hearing from you!  Thanks, 

Maybe you are looking for

  • Body and Signature not getting in reciever mail adapter

    Hi Friends, My requirement is the reciever mail adapter having the Attachment and Body and signature. Here i am getting Attachment only. I am not getting Body( example: the ftp successfully genrated this file abbc_12/03/2014.txt) and Signature. Signa

  • Restrictions passcode forgotten

    i set up a restrictions passcode some time ago and have now forgotten it. what can i do to reset my ipad i dont have much on it so dont mind reseting it. i just need to know the best way to sort this out.

  • Off-the-shelf graphics cards... any luck with Lion?

    I've been hearing online ramblings about Lion being compatible with some off-the-shelf graphics cards and Wikipedia says the Radeon 6XXX HD cards are compatible, but has anybody tried any cards that aren't clearly labeled as Mac compatible?  I know,

  • Using analytical functions in 9i - percentiles

    I'm trying to understand how to use this feature to determine percentiles for a set of data. Basically, I need to identify the values that mark the 10th,25th,median,75th and 90th percentiles. I've looked at percentile and ntile and percent rank and a

  • I can't find my username on my mac, where do I find it?

    I type in the Finder command+shift+G and then I need to type in my username to find what I'm attempting to do. What should I do? The name that is above the password bar to login is my full name but when I type that in the finder thing, it says cannot