How to pass a sequence of 'help' to run immediately

How can I place a sequence.nxlval as a parameter using, here is my code looks like

sql_string is-> insert into some_tab (col1, col2,...) (select col1: passed_seq,...) where the... (I want to insert values in sequence for col2)


and I call it like


passed_seq: = "seq_". some_dynamic_num |'. nextval' (in my PB will be sequences with the string formed as seq_10.nextval)

EXECUTE IMMEDIATE sql_string using passes_seq;

If I do like this I get

Error: - 1722:ORA - 01722: invalid number seq_10.nextval

Published by: DIVI on 8 January 2013 07:40

>
So is there another way to solve my problem, where queries are already formed and stored in a table in the form of data in the column, and I need to run those from different sequences in different scenarios.
>
Yes - you change applications to use a placeholder for the sequence you need (e.g. [SEQ_GOES_HERE]) when you need to run it you create a PL/SQL block into a VARCHAR2 variable, then use run immediately on the variable.

If your stored query would look like this

sql_string is -> insert into some_tab (col1,col2, ....) (select col1,[SEQ_GOES_HERE],......) where .... 

Load the good seq.nextval in a variable, and then replace "[SEQ_GOES_HERE]" in the query with this value.

Tags: Database

Similar Questions

  • ORA-02289 delete and create sequences to help to run immediately

    Hi all

    I copied a schema of one database to another.
    In the former base my package works very well and the procedure inside the PKG_REFRESH package below works like a charm.

    PROCEDURE FILL_TABLE(P_PROC_ID INTEGER) AS
    BEGIN
    EXECUTE IMMEDIATE (' drop sequence sq1' ");
    EXECUTE IMMEDIATE (' create the sequence sq1 with cache of 1 500 ft);
    v_kenmerk: = 'dim_1 ';
    INSERT INTO dim_1)
    Field1
    Field2
    ... < snip >
    END;

    Now that I have imported the package in a different database, and while footage used by inside the packaging procedures exist, it gives the errors below:

    Start
    *
    LAUGHING at regel 1:
    . ORA-02289: sequence does not exist
    ORA-06512: at "OWNER. PKG_REFRESH", line 117
    ORA-06512: at "OWNER. PKG_REFRESH', line 80
    ORA-01031: insufficient privileges
    ORA-06512: at "OWNER. PKG_REFRESH', line 20
    ORA-06512: at line 3 level

    I checked and the sequence is abandoned, but has not been recreated. However, it only gives me an error message when you try to create the sequence.
    I'm puzzled... search this forum, google and metalink did not help me either.

    Does anyone have an idea why this is happening? Strange is that it does not work on the old database.

    Robin

    Published by: RobbieNerve on June 30, 2011 10:27 I forgot to say that the procedure is inside the package

    Try to give an explicit subsidy to the user:

    GRANT CREATE SEQUENCE TO OWNER;
    

    Max

  • How can I create VI with inputs that run immediately when the update?

    I'm using LabView for controlling stepper motors. I would create a VI with a front panel that has 4 arrows, 2 per engine. My goal is to be able to run the VI and then press a button to move the engine.

    I created separate VI for each funcition of engines - one vi to set current operations, to determine the current travel, another to move up by a certain amount and so on. Work of these vi and I can move and adjust engines, but only by running separate VI.

    How can I combine them into a single VI and make them run to the pressure of a button or the change of a property? An example would be to establish a new current holding company and place the operation current vi run immediately and send the order to the engine. Then continue to press the arrow keys without having to hit 'run' on an another vi.

    Thank you very much


  • Oracle 11G copy a table to help to run immediately

    I want to copy the contents of a table in another aid to run immediately.

    It keeps fails with the following error

    ORA-00903: invalid table name
    ORA-06512: at "TABLE_COPY", line 6
    ORA-06512: at line 8 level



    create or replace
    procedure TABLE_COPY)
    Table1 varchar2,
    Varchar2 TABLE2)
    is
    Start
    run immediately 'insert'. TABLE2. "(select * from ' |) TABLE1 |') ' ;
    end;

    Published by: user9213000 on January 24, 2013 07:38

    user9213000 wrote:
    I want to copy the contents of a table in another aid to run immediately.

    It keeps fails with the following error

    ORA-00903: invalid table name
    ORA-06512: at "TABLE_COPY", line 6
    ORA-06512: at line 8 level

    create or replace
    procedure TABLE_COPY)
    Table1 varchar2,
    Varchar2 TABLE2)
    is
    Start
    run immediately 'insert'. TABLE2. "(select * from ' |) TABLE1 |') ' ;
    end;

    Published by: user9213000 on January 24, 2013 07:38

    Standard when boards (ab) use of EXECUTE IMMEDIATE is to compose the SQL statement in a single VARCHAR2 variable
    Then print the variable before passing to EXECUTE IMMEDIATE.
    COPY the statement & PASTE in sqlplus to validate its correctness.

  • How to pass a sequence imaq in Matlab?

    I wish I could skip an Imaq seqence (128 x 128 x 1500 frames x 2 bytes per pixel) in Matlab for treatment.  I'm currently saving the sequence of images in a table (in table vi imaq image), save the table and then open it in matlab.  This process is painfuly slow and save a lot of unnecessary data - matlab code generates and saves a subset transformed data.

    ... It turns out that Matlab remains persistent in the Labview environment once it is called then a simple loop of Labview on the number of images not the good thing...

  • REF cursor in sql dynamic help to run immediately

    Hello

    How can we get the Ref cursor out a dynamic sql statement by executing immediate proceedings
    for example, immediately run ' open CROR for select * from dynamicTable'

    in this area, CROR is a dynamic cursor and table name is dynamic (known at run time), and we can't write static sql statement.

    Thank you

    I don't know what exactly you are after but here is a sample of what can be done.

    SQL> VAR r REFCURSOR;
    SQL> BEGIN
      2          OPEN :r FOR 'SELECT * FROM DUAL';
      3  END;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SQL> PRINT r
    
    D
    -
    X
    

    You can use the OPEN... FOR education with a dynamic string.

  • How to pass the Visa Resource Name parameter to labview dll in labwindows/cvi

    Hello world

    I build a dll of labview, the prototype is: double getchannelpower (double f, uintptr_t * VISAResourceName);

    I don't know how to go from VISAResourceName to this function.

    Is it related to the ViPSession paremeter in function viOpen(REES ViSession, rn ViRsrc, ViAccessMode am, ViUInt32 ti,ViPSession vi)?

    BRs,

    lotusky

    Hey, guys:

    I figured out how to pass the parameter.

    In labview, you must replace the control of visa with string control. In this way, the generated dll function at the entrance of the string type.

    I hope this will help others!

    lotusky

  • How to set the sequence in Simple TestStand IO file

    Hi all

    Whenever I run the Simple IO - Top Level.vi, it loads the last file in the sequence of race.  How default to certain sequence?

    Great appreciate for your help.

    -Kenny

    You can use the method of file sequence, open the application Manager (then you just need to connect the path to the file)

  • How to passing arguments to an exe

    Hai Everbody

    I know that LabVIEW has the ability to call an exe file created in different platform, can I know how to pass arguments to the special exe (which is located in another platform) via LabVIEW... I wish someone could help me out of this

    Thanks for your answers, I found the solution... As the exe is in .net, I used the syntax for the command line arguments in .net...

  • How to pass the value?

    Hello.. I'm creating an application of streaming, in which I have a list field in a screen like this...

    1

    --------

    2

    --------

    3

    --------

    and when the item 1 is selected means a url must be passed to the video player...

    I created the list field screen in a package and a video player in other package... but I do not know how to pass the value of the field from the list to the player... Help, please... its URGENT...

    You can get the index selected by the listname.getSelectedIndex () method and compare that value with Vector data (data store URL) .that you will give a correct value from the URL and pass it.

  • How to pass the parameter to the script for interface/Package in ODI

    Hello

    Yesterday I asked a question how to pass a parameter to run the script interface or the procedure?

    I don't know if it's possible.

    Any clarification will help you.

    Kind regards

    Mahesh

    Mahesh, why not try this in your machine? This will give you more clarity and confidence.

    ODI has always check if there is any variable used inside an object regardless of the interface or procedure or package. So whenever you generate the script, you will be asked to select the boot parameters. She's. Whenever you use this scenario, make sure you that you add the variables in the additional variables section of the Properties tab.

    So answer is that it is possible.

    Bravo!

  • How to pass view controller class bean to model bean class value?

    Hi all

    I use JDev 11.1.6. I do not use the ADF BC. The use of EJB. Do not use session scope.

    My question is

    I get the value of the input box. I put this value in the class variable Bean (bean View Controller class). I need to pass this value to the variable in class model bean.

    Help, please...

    Thank you

    Hello

    It's simple enough to create a method on the model (AMImpl or VOImpl) and set the setting for the values you wish to obtain ViewController then add expose this method in the client interface

    next is to add this method to link pagedef and access the VC bean managed using the OperationBinding class and pass the value of the parameters of this method here

    This is how you pass a ViewController value model

    See - Fortune Minds - Oracle ADF: how to call the Application Module of backing bean method

    https://blogs.Oracle.com/jdevotnharvest/entry/best_practice_invoking_business_services

    Ashish

  • How to pass the PHP variable to menu jQuery Modal popup

    Hello

    Need help to find how to pass a variable in php (which is recovered in a while loop) in a modal window.

    There is a list of users on the page (shown with a while loop), with buttons Remove next to each of them.

    When the administrator clicks the button Delete for that specific user, a modal window appears confirming their action.

    I can't find a simple way to communicate the id of the user to be removed the modal (where the query is performed, once 'Yes to confirm deletion' is clicked).

    I deleted the jQuery, seeing as how this could change how the modal opens and closes.

    This is the modal:

    < div class = "modal" >

    < div class = "modal_wrapper" >

    < div class = "modal_title" > are you sure you want to delete this user? < / div >

    < div class = "modal_content" >

    < div class = "modal_button_no" > n < / div >

    < div class = "modal_button_yes" > Yes, delete it < / div >

    < / div >

    < / div >

    < / div >

    < div class = "delete_btn" > delete user < / div >

    The variable with the user name is:

    $user_id

    Any help would be much appreciated!

    Thank you

    It is a fairly simple procedure. Personally I'm not sure that its worth the effort for a box of administration but good we all have different opinions - there is no wrong or it.

    Suppose that your buttons delete on your page are anchor tags and you have locked down your database of names to create anchor tags. The value of dir below has been inserted via php through loop and is your RegID.

    Delete

    Delete

    Delete

    Delete

    When you click the anchor tag (that class name "delete") opens a lightbox. You also have to collect the value of "dir" at the time the lightbox opens - happening of value to a hidden in the lighbox code entry field.

    The value of the "dir" command is passed to the light table in a hidden form field:

    "You have a delete button in the light table with the class of ' delete_record ':

    Delete the record

    When the user clicks on the button Delete in the light table the value of hidden form field is harvested and forwarded to your page of delete_record.php via the jquery/ajax script below, were also on the same page.

    Your delete_record.php would look like below, assuming that you use mysqli or if you are using mysql then you would follow the same delete procedure as usual.

    <>

    $conn = new mysqli ('localhost', 'root', 'root', 'name');

    {if ($conn-> connect_errno)}

    echo $conn-> connect_error;

    Die (' sorry, can not connect to the moment, try again later ');

    }

    ?>

    <>

    delete the record

    $record_id = $conn-> real_escape_string (stripslashes (trim($_POST['record_id'])));

    $conn-> query ("' DELETE FROM names WHERE record_id = ' $record_id ' '");

    $record_deleted = "true";

    ?>

    An alert box will appear at the end, confirming that the record has been deleted. You do not have to deploy an ugly alert box - you sends the data to the device of light therapy from the delete_record.php page in a few nice melted in

    If you want to be more subtle about it.

  • How to pass the value of the run-time file .sh by Oracle procedure

    I have a file test.sh that contain

    #1/bin/bash

    exp test/test@orcl file=/home/oracle/dump/test.dmp log=/home/oracle/dump/test.dmp grants = Y = index constraints Y = Y = (test) owner statistics = none

    Exit 0

    I craete a work called Create_job_proc in this work, I want to pass the value of job_action is the location of the file test.sh to

    /U01/home/Oracle/dump/test.sh and want to spend the test/test@orcl as a variable...

    Please suggest me... how to pass the value of Job_Action which will replace the .sh file content test/test@orcl to the value of the time of execution as scott/tiger@hr

    Thank you much Parth... It works perfectly...

    Thank you all for your help...

  • I have one of my programs adobe on a mac pro, which is broken. How to pass the program over this i mac?

    I have one of my Macbookpros that has a broken screen. How to pass the program Adobe of it ti that I have Mac?

    Download/install the desktop application, connect and install applications subscription.

    https://helpx.Adobe.com/creative-cloud/help/download-install-app.html

Maybe you are looking for