Passing the sequence as a parameter to a procedure.

I want to use the sequence value in the call to a procedure.
Something like :
EXEC sp_Calling(SEQ_PASS.NEXTVAL);
but this isnt allowed as the parameter declaration is a number.
Can anyone tell me how I can resolve this.
plus i dont wanto use a variable like :i
as want to run this EXEC a couple of hundred times. So i'll have to take the nextval in 'i' before every EXEC statement.
Is there any preprocessing alternative.
Thanx.

You could create a loop outside the procedure, something like :
SQL> declare
  2     seq_num number;
  3  begin
  4     for i in 1..<N> loop
  5             select <sequence name>.nextval into seq_num from dual;
  6             <procedure name>(seq_num);
  7     end loop;
  8  end;
SQL>

Similar Messages

  • Passing the database name as a PL/SQL procedure parameter

    How do I pass the name of the database as a parameter to a procedure?
    If dbs is the variable name to which I pass the database name as shown in the example,
    CREATE OR REPLACE PROCEDURE Extract_gl_acct_Tbl(dbs varchar2)
    and I use dbs in the code as follows,
    SELECT ACCOUNT,
    SETID
    FROM SYSADM.PS_GL_ACCOUNT_TBL@dbs
    It gives me an error saying 'ORA-04054: database link DBS does not exist'.

    You will need to use dynamic SQL to handle this:
    create or replace ...
    is
    type rc is ref cursor;
    v_rc rc;
    begin
    open v_rc for 'select ... from sysadm.ps_gl_account_tbl@' || dbs;
    fetch v_rc into ... -- some variables
    -- if multiple rows, you'll need to do the fetch in a loop and exit when v_rc%notfound.
    close v_rc;
    end;

  • Passing the name of a table to a procedure

    Can anyone tell me how you can pass the name of a table to a procedure ?
    I am trying to write a generic procedure that will have the table name and the fieldname passed to it :-
    as in :-
    Select Fieldname FROM Tablename;
    null

    Refere to the documentation of
    built in package dbms_sql.

  • How can pass the Maximum query String parameter in browser.....?? (URGENT)

    hi Guys,
    i make the application, in which lots of data record with id, whenever i clicked to the SUBMIT button, it wil forwarded to the next page.
    But The problem is.....when we pass the 30 id in a query string parameter that' fine but when it is incresing it is not transfaring to the next page. how i can do this.
    As per the concept EVERY BROWSER HAVING THE LIMITATION..
    hope all of u help me.
    saM

    hey all of you are saying right..!!
    But you know the doPost() method having the limitation, that is
    1 MB. so how can i used this method.
    I know the second way....Like make the hidden control with mantain the session, but i can not use this(Client do't want this).
    so please guys help me........
    saM

  • How to pass a cursor as IN parameter to a procedure

    Hello
    I want to pass a cursor to a procedure as IN parameter.
    See the below piece of code:
    Cursor mycur is select * from table_name;
    Procedure myproc(mycur IN ...)
    begin
    fetch mycur into v_rec;
    {want to do some updates here}
    end;
    Please suggest how can I pass the cursor?
    Thanks in advance !!!!

    793059 wrote:
    I want to pass a cursor to a procedure as IN parameter.You can use the PL/SQL type called sys_refcursor - and open a ref cursor and pass that to the procedure as input parameter.
    Note that the SQL projection of the cursor is unknown at compilation time - and thus cannot be checked. As this checking only happens at run-time, you may get errors attempting to fetch columns from the ref cursor that does not exist in its projection.
    You also need to ask yourself whether this approach is a logical and robust one - it usually is not. The typical cursor processing template in PL/SQL looks as follows:
    begin
      open cursorVariable;
      loop
        fetch cursorVariable bulk collect into bufferVariable limit MAX_ROWS_FETCH;
        for i in 1..bufferVariable.Count
        loop
          MyProcedure( buffer(i) );   --// <-- Pass a row structure to your procedure and not a cursor
        end loop;
        ..etc..
        exit when cursorVariable%not_found;
      end loop;
      close cursorVariable;
    end;

  • How to pass the sequence number of current loop in a for loop in FPGA vi to the host

    PCI-7830R
    LV 8.2
    What I was trying to do is to use multiple DIO to generate pulse at different sequence. Mode one is to automatically sweep from DIO1 to DIO20; mode 2 is several DIOs generate pulse simoutaneously.  So I use a case structure to make the selection, in the mean time, I set up two for loop in each case so that I can use multiple pulse generations. For example, in scanning mode, if I set 2 exposures, it sweeps from 1 to 20 then do it again.  
    Then I need to get the loop sequence number, i of each scenario. So I put an indicator within the first loop, and create a local variable of it and put in the second one.  Running the FPGA vi alone, I can see the indicator change in each case from 0 to N-1, N being the for loop time.But in the host vi, I tried to add this indicator as an element in the read/write invoke method, in the debugging mode, I could only see it directly jump to N-1 without all the changes I saw in FPGA vi. 
    Is it possible to get this number passed correctly from FPGA vi to the host vi? Thanks

    Thanks for the reply Jared.
    Excuse me if it looks incorrect, but I'm new to FPGA programming, so I would have to look into the FIFO you referred to.  I used local variables because for one thing I have several different cases containing for loop in each of them, and I only want one indicator for the "i".  If I put the indicator out of any for loop, it's only gonna show the last number which is N-1.  For the other thing, it seems like property nodes are not allowed in FPGA vi.  And by doing this, I can see the i number changing from 0 to N-1 in each case, well, in FPGA vi's front panel.  But while I ran the host vi with everything, the indicator in host vi's front panel only showed the last number N-1. It may be the reason you said, it happened too fast before the indicator in host vi can catch it.
    What I want to realize is to group the data I collect in host vi, for example, when I choose multiple exposure in each mode, and the FPGA runs 1 through 20 then do it again, I want the data stored in two groups using the loop sequence number as the seperator in file name.  So it goes like 1-1, 2-1.......20-1; then 1-2, 2-2,.....20-2.

  • Passing the xml data as parameter to procedure

    i have table like this
    CREATE TABLE employeeDetails
    EmpName VARCHAR2(50),
    EmpSal INTEGER,
    DeptNo INTEGER,
    JoinDate DATE
    i am getting the i/p data in xml format to extract data i saw the code in net.http://riteshk.blogspot.com/2008/09/sending-xml-string-as-input-parameter.html
    CREATE OR REPLACE PROCEDURE Insert_Employee_Data (ip_emp_details IN XMLTYPE)
    IS
    BEGIN
    FOR i IN
    (SELECT XMLTYPE.EXTRACT (VALUE (a),
    '/Root/EmpName/text()').getstringval
    () AS ipempname,
    XMLTYPE.EXTRACT (VALUE (a), '/Root/EmpSal/text()').getstringval
    () AS ipempsal,
    XMLTYPE.EXTRACT (VALUE (a), '/Root/DeptNo/text()').getstringval
    () AS ipdeptno,
    XMLTYPE.EXTRACT (VALUE (a),
    '/Root/JoinDate/text()'
    ).getstringval () AS ipjoindate
    FROM TABLE (XMLSEQUENCE (ip_emp_details.EXTRACT ('/EmployeeData/Root')
    ) a)
    LOOP
    INSERT INTO EMPLOYEEDETAILS
    (empname, empsal, deptno, joindate
    VALUES (i.ipempname, i.ipempsal, i.ipdeptno, i.ipjoindate
    END LOOP;
    END Insert_Employee_Data;
    i want to test the procedure in database itself.
    how to call the procedure in database to test that procedure by passing sample data.how to pass paratmeters while cakking that procedure in database itself to test that the procedure is working or not
    /

    Thats the way you would test it:
    SQL> create table employeedetails
       empname    varchar2 (50),
       empsal     integer,
       deptno     integer,
       joindate   date
    Table created.
    SQL> create or replace procedure insert_employee_data (ip_emp_details in xmltype)
    is
    begin
       for i
       in (select   xmltype.extract (value (a),
                                     'Root/EmpName/text()').getstringval ()
                       as ipempname,
                    xmltype.extract (value (a),
                                     'Root/EmpSal/text()').getnumberval ()
                       as ipempsal,
                    xmltype.extract (value (a),
                                     'Root/DeptNo/text()').getnumberval ()
                       as ipdeptno,
                    xmltype.extract (value (a),
                                     'Root/JoinDate/text()').getstringval ()
                       as ipjoindate
             from   table(xmlsequence (
                             ip_emp_details.extract ('/EmployeeData/Root')
                          )) a)
       loop
          insert into employeedetails (empname,
                                       empsal,
                                       deptno,
                                       joindate)
            values   (i.ipempname,
                      i.ipempsal,
                      i.ipdeptno,
                      to_date (i.ipjoindate, 'dd-mon-rrrr', 'nls_date_language=english'));
       end loop;
    end insert_employee_data;
    Procedure created.
    SQL> begin
       insert_employee_data(xmltype('<?xml version=''1.0'' encoding=''utf-8'' ?>
    <EmployeeData>
    <Root>
    <EmpName>Ritesh</EmpName>
    <EmpSal>10000</EmpSal>
    <DeptNo>1010</DeptNo>
    <JoinDate>03-Apr-2006</JoinDate>
    </Root>
    <Root>
    <EmpName>Rajiv</EmpName>
    <EmpSal>20000</EmpSal>
    <DeptNo>2020</DeptNo>
    <JoinDate>05-May-2007</JoinDate>
    </Root>
    </EmployeeData>'));
    end;
    PL/SQL procedure successfully completed.
    SQL> select   * from employeedetails
    EMPNAME                  EMPSAL     DEPTNO JOINDATE
    Ritesh                    10000       1010 03.04.06
    Rajiv                     20000       2020 05.05.07
    2 rows selected.Much better and more efficient is of course to completly avoid the loop and just use:
    insert into employeedetails
       select   xmltype.extract (value (a),
                                 'Root/EmpName/text()').getstringval ()
                   as ipempname,
                xmltype.extract (value (a), 'Root/EmpSal/text()').getnumberval ()
                   as ipempsal,
                xmltype.extract (value (a), 'Root/DeptNo/text()').getnumberval ()
                   as ipdeptno,
                to_date (
                   xmltype.extract (value (a),
                                    'Root/JoinDate/text()').getstringval (),
                   'dd-mon-rrrr',
                   'nls_date_language=english'
                   as ipjoindate
         from   table (
                   xmlsequence (ip_emp_details.extract ('/EmployeeData/Root'))
                ) a;
    ....

  • Pass the + operator as a parameter

    could anybody tell me is there any way that i can pass operators(say +,-,sin,tan) as a parameter to a function

    i understand that, everything must be defined.But u
    see Math.tan is predefined i just need to callit ,,
    now the question is how can i pass a referenceto all
    these functions without having to define aseparate
    method for each operation.why are you so afraid to define a class or methodto each operation? it don't > cost nuthin'
    this is the place where searches for a better code....And defining a method for each operation is that better code!

  • Pass multiple values with IN parameter in stored procedure

    CREATE TABLE VTEST_INSERT (
    MY_ID NUMBER,
    COLUMN1 VARCHAR2(50)
    --SELECT * FROM VTEST_INSERT;
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (1,'TEST1');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (2,'TEST2');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (3,'TEST3');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (4,'TEST4');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (5,'TEST5');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (1,'TEST6');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (2,'TEST7');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (3,'TEST8');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (4,'TEST9');
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (5,'TEST10');
    CREATE OR REPLACE
    PROCEDURE VTEST_INSERT_SP(vid IN VARCHAR2,vname IN VARCHAR2)
    AS
    BEGIN
    DELETE FROM VTEST_INSERT WHERE MY_ID IN (vid);
    INSERT INTO VTEST_INSERT (MY_ID,COLUMN1) VALUES (vid,vname);
    END;
    EXEC VTEST_INSERT_SP(1,'TEST999');
    This all works fine above. But I want to be able to pass in multiple vname values. so something like:
    EXEC VTEST_INSERT_SP(1,'TEST999','TEST888','TEST777');
    all help appreciated. thank you.
    This would do multiple inserts each with the same vid and the different vname values.

    Try something like this
    SET SQLBLANKLINES ON;
    ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';
    DROP TABLE vtest_insert;
    CREATE TABLE vtest_insert(vid NUMBER, vname VARCHAR2(20));
    INSERT ALL
       INTO vtest_insert(vid, vname) VALUES(1, 'aaaa')
       INTO vtest_insert(vid, vname) VALUES(1, 'bb')
       INTO vtest_insert(vid, vname) VALUES(1, 'cccccc')
       INTO vtest_insert(vid, vname) VALUES(2, 'ddd')
       INTO vtest_insert(vid, vname) VALUES(2, 'ee')
    SELECT * FROM "PUBLIC".dual;
    SELECT * FROM vtest_insert;
    CREATE OR REPLACE TYPE vnames_tab_ty IS TABLE OF VARCHAR2(20)
    SHOW ERRORS;
    CREATE OR REPLACE PROCEDURE vtest_insert_sp
       p_vid     IN  vtest_insert.vid%TYPE,
       p_vnames  IN  vnames_tab_ty
    AUTHID DEFINER
    IS
    BEGIN
       DELETE FROM vtest_insert WHERE vid = p_vid;
       FORALL idx IN p_vnames.FIRST .. p_vnames.LAST
           INSERT INTO vtest_insert(vid, vname) VALUES(p_vid, p_vnames(idx));
    END vtest_insert_sp;
    SHOW ERRORS;
    <<bk>>
    DECLARE
      vnames vnames_tab_ty;
      vid vtest_insert.vid%TYPE;
    BEGIN
      bk.vid := 1;
      bk.vnames := vnames_tab_ty('vn-01', 'vn-02', 'vn-03');
      vtest_insert_sp(p_vid=>bk.vid, p_vnames=>bk.vnames);
      COMMIT;
      bk.vid := 2;
      bk.vnames := vnames_tab_ty('vn-04', 'vn-05', 'vn-06', 'vn-07');
      vtest_insert_sp(p_vid=>bk.vid, p_vnames=>bk.vnames);
      COMMIT;
    END;
    SELECT * FROM vtest_insert;
    Which produces the following output
    Table created.
    5 rows created.
           VID VNAME
         1 aaaa
         1 bb
         1 cccccc
         2 ddd
         2 ee
    Type created.
    No errors.
    Procedure created.
    No errors.
    PL/SQL procedure successfully completed.
           VID VNAME
         1 vn-01
         1 vn-02
         1 vn-03
         2 vn-04
         2 vn-05
         2 vn-06
         2 vn-07
    7 rows selected.
    SQL>
    Regards,
    Dariyoosh

  • PASSING A VARRAY as parameter in a procedure and returning the same VARRAY

    Hi,
    I am passing a varray as IN parameter to a procedure. I want to retreive the same VARRAY from the procedure.
    DECLARE
       TYPE str_array IS VARRAY (4) OF VARCHAR2 (50);
       v_array           str_array;  
       PROCEDURE process_array (
          v_str_array             str_array
       AS
       BEGIN
          FOR i IN v_str_array.FIRST .. v_str_array.LAST
          LOOP
             DBMS_OUTPUT.put_line ('Hello ' || v_str_array (i));
          END LOOP;
       END;
    BEGIN
       v_array    := str_array ('John', 'Paul', 'Ringo', 'George');
       process_array (v_array);
       -- can also pass unbound Str_Array
       --process_array (str_array ('John', 'Paul', 'Ringo', 'George'));
    --   DBMS_OUTPUT.put_line ('Hello ' || v_str_out_array (i));
    END;I want to change this procedure so that i will retreive the same as VARRAY out from the procedure.
    Can anyone help me on the same

       PROCEDURE process_array (
          v_str_array             IN OUT str_array
       )If your varray is large then you can try:
       PROCEDURE process_array (
          v_str_array             IN OUT NOCOPY str_array
       )but you should learn about possible side-effects if there is an error while executing the procedure. In short words: if you don't use NOCOPY and an error occurs during execution of process_array procedure then your varray is not changed - all chages to the value of your varray are 'rolled back'. If you use NOCOPY then it depends...

  • Pass the variable from timeline to one of my classes !?

    Hello !
    The title says it all.
    I need to pass a boolean variable initially set to false to one of my classes called "EasyGame".
    It is than changed to true when one of the function in this class is runned.
    I tried some different ways but had no luck.
    Anyone have an idea ?

    If you instantiate the class in the timeline, you can just call a method in the class - passing the variable as a parameter.
    easyGame.setTimelineVar(myVar);
    And have another method that lets you retrieve the value:
    myVar = easyGame.getTimelineVar();

  • How to pass a command line argument to the sequence?

    Hi,
    My GUI is written in VB.NET. I can read the command line argument in the GUI, using: Me.AxApplicationMgr.CommandLineArguments(). But I don't know how to pass it on to my sequence file which the GUI invokes. How do I read the command line argument from the sequence file?
    My purpose, is to have the same basic sequence execute different subsequences depending on starting conditions...
    I am using TestStand 3.0 with a VB.NET GUI, on Windows XP.
    I'd appreciate any help on the subject.
    Alan

    Hi Alan,
    One obvious way would be to add parameter(s) to the MainSequence and then modify the process model sequence file to use the new parameter(s) in the step "MainSequence Callback"  in either Single Pass or Test UUTs but I wouldn't recommend this approach.
    The sequence file to be run via the entry point can be found at "RunState.ProcessModelClient" and the lookup string to the MainSequence would be "RunState.ProcessModelClient.Data.Seq["MainSequence"] or .Seq[0] .
    Therefore you could quite easy use the SetVal method to setup a Local variable in the MainSequence of your Sequence File to receive the command line string.
    Also you could do this without altering the Process Model Sequence File by using the Callback Sequence ProcessSetup in your Sequence File.
    As an example.
    You have a string in your Locals of MainSequence called CmdLineStr.
    If you add the Callback Sequence ProcessSetup to your SequenceFile, then add an ActiveX Automation Adapter step which is setup for a PropertyObject and the reference is RunState.Caller.RunState.ProcessModel.Data.Seq[0].Locals.CmdLineStr.
    There is an extra RunState.Caller to the lookup string, that's because I am doing the work in a SubSequence of Entry Point Sequence.
    The method to use is SetValString and the parameters of the PropertyObject will be
    lookupString = ""
    options = 0 or 1
    newValue = where evey you have stored you command line string.
    Now when you run your sequence file you will find that the Locals.CmdLineStr will contain your parameter string.
    Hope this is of help to you.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Unable to pass the parameter to other portlet

    Hi,
    I am trying to pass the parameter from one portlet to other portlet using the convention below...
    Example say you have two reports on a page dept and employee. You want to refresh employee report by clicking on
    the dept in the department report in the same page.
    (1) Create the first report based on the query
    SELECT htf.anchor('http://domain/servlet/page?&_pageid=97&_dad=portal_dad&_schema=portal_schema&_mode=3&dept_code='||DEPTNO,DEPTNO) Department,
    dname FROM scott.dept;
    (2) Create a 2nd report
    select * from EMP where DEPTNO = :dept_code
    (3) In the the additional pl/sql code section before display page on the 2nd report do this
    portal30.wwv_name_value.replace_value(
    l_arg_names, l_arg_values,
    p_reference_path||'.dept_code',portal30.wwv_standard_util.string_to_table2(nvl(get_value('dept_code'),10)));
    (4) Created a page and added these reports as portlets.
    In point (4) I am not getting the value of selected deptno in 'dept_code'. It is always taking the default value as '10'...
    I like to have the quick solution for this so that I can show the demo to my client...
    Thanks in Advance
    Sudheer

    Hi Ali,
    We can add parameterized queries to any TableAdapter (and controls to accept parameter values and execute the query) using the
    Search Criteria Builder Dialog Box. 
    For detail information, please refer to the following article to create a Windows Form to Search Data:
    http://technet.microsoft.com/en-us/library/hbsty6z7.aspx
    In addition, this issue is more related to Windows Form. I would suggest open a new thread in Windows Form forum if you have any more qestions:
    http://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winforms
    Regards, 
    Elvis Long
    TechNet Community Support

  • Web link to pass the parameter to custom web app then update the field

    Hi,
    I have created the web link in service request object to refer Account Object. I want to let user able to select the account from web link then base on the current SR no and account that have created update the record in CRMOD. My question is how to pass the parameter out to my external web app so that they can update my SR correctly?
    Thank you

    Hi Messer,
    I have put in the syntax as below :-
    https://secure-ausomxega.crmondemand.com/OnDemand/user/AssocAccountPopup?mapBC=Service+Request&OACTRL=Account&ophi=PopupNewForm.Account+Id&pfid=PopupNewForm&OMTHD=AssocPopup&OMTGT=PopupSearchList&assocInit=Y&opht=4&OAOBJ=Service+Request&mapField=Account&ophd=PopupNewForm.Account&ophpd=3&disableclear=Y&ophr=AssocAccountPopup&assocval=&ParentType=Edit
    This pop up screen wil let the user to select the account then i will pass the account and the SR to external web app to update back the CRMOD. I am not too sure the above syntax is correct or maybe can you give some example.
    I am new in CRMOD, hope that you can advice on this.
    Thank you,
    SK

  • How to pass the parameter of a stored procedure to iReport

    Hi... i don't know how to pass the parameter of the stored procedure to the iReport.
    In the Report Query, i tried
    1. sp_storedprocedure ' value'
    2. sp_storedprocedure +''''+$P{parameter}+''''+
    3. sp_storedprocedure +$V+$P{parameter}++$F($F is a variable having a value of ' (a single quote))may you enlighten us please? thank you

    For M$ SQL server I find that it only works when U use the fully qualified name...
    e.g. catalod.dbo.my_procedure_name 'variable'
    My full query in the Report Query window is something like this:
    EXEC arc.dbo.jasper_Invoice 1000
    Note that you may find that selecting from VIEWS / TABLES fails for no apparent reason and iReport will prompt you with the usual very unhelpful (we have what we "pay" for) prompt, stating that "The document is empty".
    To work around this issue, where a statement like "SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id=1000" does not work, simply create a PROC, something like:
    CREATE PROC jasper_MyProc (@my_rec_id integer) AS
    SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id= @my_rec_id integer
    ...to wrap your SELECT statement, then call the PROC
    Edited by: Sylinsr on Apr 22, 2008 4:23 PM

Maybe you are looking for

  • MacBook Pro died, can I restore back up from previous OS to New Macbook Pro with Mavericks on it?

    My son's (grad student) MacBook Pro's logic board went out two weeks ago. We have a new one coming tommorrow, which has Mavericks. His back up from the older computer has the previous operating system - is he going to run into any problems restoring

  • Web Part Zone personalization

    Using SharePoint 2013; Is there an option out of the box to personalize Web Part Zone like we have for Web Parts. We have a requirement to create a Web Part page in which users can personalize by adding the Web Parts they wanted to see. Scenario: Use

  • HT4689 do i have to use mission control or can i set it to another method ?

    I don't have a sensor mouse, i am using an old mouse and don't really feel like buying a whole new mouse.  Do I have to use mission control or can I get an app to customize the computer to my personal style?

  • WebLogic Administrator / Java Developer position in Miami

    We are currently looking for a WebLogic Admin for a client in the Miami, FL area (Permanent position) This right candidate must have experience with the following technical skill sets:_ · Extensive experience with WebLogic and SQL Server · Solid expe

  • Access Levels to change Universe

    Hi I have created a WebI template (with formated layout) based on a kind of 'dummy universe'. The goal is that some 'power users' should be able to copy this template to their favorites and then change the universe to one they are allowed to use. The