How i will pass table within procedure

how i will pass table within procedure and call another procedure.
can anybody give some example

You are not specific at all. Do you mean you want to pass table_name as parameter to a procedure? Do you want to pass tables_name dynamically while the procedure is running? If so, use dynamic sql. You can directly call another procedure within a procedure.
create or replace procedure sample_proc
as
v_table_name varchar2(10);
begin
   select table_name into v_table_name
   from user_tables
   where table_name = 'EMP';
   procedure_2(v_table_name);
end;And the procedure_2 would be
create or replace procedure procedure_2(p_table_name varchar2)
as
begin
   execute immediate 'DROP TABLE '||p_table_name;
end;For God's sake please completely describe what you want, otherwise we don't know what on Earth you want!
Cheers
Sarma.

Similar Messages

  • Create a procedure which will pass table name as an argument

    Please let me know, I want to create a procedure which will take
    table name as an argument and will display total no. of rows of
    that table.

    Hopefully this code will help u.
    CREATE OR REPLACE PROCEDURE P1(TAB_NAME IN VARCHAR2, ROW_NO
    OUT NUMBER)
    AS
    SQL_STMT VARCHAR2(1000);
    BEGIN
    SQL_STMT := 'SELECT COUNT(*) FROM ' || TAB_NAME;
    EXECUTE IMMEDIATE SQL_STMT INTO ROW_NO;
    END;
    SQL > VAR A NUMBER
    SQL > EXEC P1('EMP',:A);
    SQL > PRINT A
    A
    12
    SQL > SELECT COUNT(*) FROM EMP;
    COUNT(*)
    12

  • How do you list tables within the tablespace?

    Does anyone know how to list and view the tables within the tablespace. I am new to Oracle and I would like to view the tables, but my documentation is telling me how to create everything, but not to view it. Please advise, and thanks again.

    select owner, table_name
      from user_tables  -- or all_tables, or dba_tables
    where tablespace_name = :ts_name;

  • How to reference source table in procedure?

    I created a procedure with only 1 sql statement:
    delete * from source_table_name@connector where ...
    I put this procedure in pre-mapping, then validate, pre-deploy are both ok, but when I deployed it, it caused "cannot find table or view" error.
    How to reference source table in the procedure? Thanks.

    anybody helps??? Please.
    Thanks.

  • How do i pass recordsets across procedures

    Hi,
    I wanted to know how to pass a record set from one procedure to another procedure using a table of a used defined type and how do i access the values from the recordset for any manipulation within the procedure..
    For eg i have a table/Ref cursor on a user defined type which has two columns empno,deptno... as a out parameter from a procedure... How do i take this in in a different procedure and access the values..
    Thanks
    Kiran

    Hello,
    Thanks for posting to the NI Discussion Forums.  The channel name attribute is one of the
    custom waveform attributes added by the DAQ driver software.  In addition to these items added by DAQ, it seems
    as though any custom attribute added to the waveform is not sent with
    the shared variable.  I have sent notice
    to R&D to take a look at this problem (issue 3VQEIA3A), but I do not have
    any sort of timeline on when/what will come of this.  For now, it looks like you will have to send
    any data about the waveform over to the Windows client machine separately.  For example, you could create a new variable
    of 2-D string data where you would populate the array with <key,value>
    pairs of the waveform data you are concerned with.  If you were interested in how to extract the channel
    name from the waveform, or any of the other properties set by the DAQ software
    check out the “details” in the context help for the “set waveform attribute”
    VI.
    Hope this helps!
    Travis M
    LabVIEW R&D
    National Instruments
    Attachments:
    waveformattributes.zip ‏36 KB

  • How to list all tables/stored procedures used by the report

    All the reports i create are getting data from stored procedure(s). Is there a way to obtaining a listing of all the stored procedures without having to open report by report and check under Database > Set Datasource Location > Properties > Table Name?
    Finding this info it would be extremely valuable, as it would help me to judge the impact of any changes that i might be considering to one or more of the stored proc.
    So far i maintained a manual listing but it is not up-to-date and reliable. I would rather prefer to get an updated listing every time i want to change/drop a stored procedure.
    Thanks so much for your help.
    Rick

    Dell can you be a little bit more specific about the SDK solution. I could ask one of the developers to help me but i need to gather more details.
    I took a look .rpt inspector Pro but it does not do what i need. All i need is the the listing of all the database tables (in my case stored procs) used in my reports. No need to replace or change anything. I need to scan the directory where i have all the reports for the different applications and get report names and table/stored procs used. i can export the txt file to excel and that's all.

  • How to feel interal table in Workflow?

    Hi Experts,
    Right now i m creating one workflow in which i have an internal table with 2 fields. This internal table is multiline internal table.
    But the thing is i dont know how to feel entry into the internal table. I hv created one workarea with 2 fields. but i m not getting that how i will pass those values into that work area :(.
    after passing into the workarea i think i will be able to append values into the internal table.
    please help me out with this problem.
    if more clarifications are required then also ask.
    Thank you in advance.
    Regards,
    Hetal....

    Hey Hetal,
    Thanks for clearing the question.
    Well, youur requirement is that you want to pass the values
    DOKAR STY
    DOKNR STYLEDOC50
    DOKVR 000
    DOKTL 00
    in a table.
    It is very very simple.
    Well, I think you need to pass these values from the workflow container to the function module within the method.
    Well, first you have to pass the values ifirst to the workflow container, If you have then it is lovely otherwise you have to pass programatically.
    If you workflow container is triggered by events:-
    Make a container element in the workflow container and the event container.
    Do the bindings so that the values of the event container table goes to the workflow container table.
    Now, while populating the event container in the code do the following things:
    Create another internal table with the same structure in the code and then populate the table.
    Create a container table with the type SWCONT.
    now write the statement SWC_SET_TABLE <container table> 'ELEMENT NAME of the table in the event container' Internal table.
    This will set the values from the code to the event container.
    If your workflow container is being triggered by function module:-
    Similarly for this case also:-
    Now, while populating the event container in the code do the following things:
    Create another internal table with the same structure in the code and then populate the table.
    Create a container table with the type SWCONT.
    now write the statement SWC_SET_TABLE <container table> 'ELEMENT NAME of the table in the event container' Internal table.
    This will set the values from the code to the event container.
    If you are using some activity within the workflow to populate the table with those values:-
    Within the method you have to write the code:
    Now, while populating the event container in the code do the following things:
    Create another internal table with the same structure in the code and then populate the table.
    Create a container table with the type SWCONT.
    now write the statement SWC_SET_TABLE <container table> 'ELEMENT NAME of the table in the event container' Internal table.
    This will set the values from the code to the event container.
    Now in the activity and the method you have to do the bindings and the values will be passed.
    You can see the values in the workflow container.
    I think that will solve the problem.
    Warm Regards.
    Abhijit.

  • How we will use bapi function modules Ex. BAPI_SALESORDER_CHANGE

    How we will pass the parameters to this Function Module.
    What is the step by step process .

    HI,
    Check this code... Here this program is changing the delivery block for a sales order.. like this you just need to identify what you want to change and pass data to the bapi as required.
    DATA: BAPISDH1X LIKE BAPISDH1X.
    DATA: BAPISDH1 LIKE BAPISDH1.
    PARAMETERS: P_VBELN LIKE VBAK-VBELN OBLIGATORY.
    PARAMETERS: P_LIFSK  LIKE VBAK-LIFSK OBLIGATORY.
    Header
    BAPISDH1-DLV_BLOCK = p_lifsk.   " Delivery block
    header X
    BAPISDH1X-DLV_BLOCK = 'X'.   " Delivery block
    BAPISDH1X-UPDATEFLAG = 'U'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = P_VBELN
    order_header_in   = BAPISDH1
    order_header_inx = BAPISDH1X
    tables
    return = T_RETURN
    LOOP AT T_RETURN WHERE TYPE = 'E' OR TYPE = 'A'.
      EXIT.
    ENDLOOP.
    Check for error messages.
    IF SY-SUBRC = 0.
      WRITE: / 'Sales order not updated', T_RETURN-MESSAGE.
    ELSE.
    Successfully updated
      WRITE: / 'Sales order updated'.
    ENDIF.
    COMMIT WORK.
    Thanks
    mahesh

  • Passing table values to RFC

    how can i pass tables to RFC as input?
    Thanks.

    Thanks for the replies.
    I have actually written the below code, but not getting the output.
    Model1 mod=new Model1();
      zbapi_Input ip=new Zbapi_Input(mod);
                ztable tab1;
                tab1=new Ztable(mod);
                tab1.setcode("2100");
              input.addZtable(tab1);
                wdContext.nodezbapi_Input ().bind(ip);
                try {
                   wdContext.currentzbapi_Input Element().modelObject().execute();
              } catch (ARFC2ModelExecuteException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();

  • How to pass tables in Guided Procedures from VC

    Hi experts!
    I'am working in a workflow scenario, more precisely an approve-reject workflow scenario.
    I've defined all the start and the end points belonging to the respective iviews (I mean the sender and the approver iviews), following the  [Modeling Visual Composer iViews for Guided Procedures|http://help.sap.com/saphelp_nw70/helpdata/en/44/429bbd709914bce10000000a155369/frameset.htm]
    and everything works ok if I pass input fields, data fields, or boolean fields.
    But I need to pass tables (In fact, I need to pass MORE THAN ONE table)....  Is that possible?
    How do I make it?
    Any help will be apprecieated and point-rewarded.
    Thanks in advance
    Best Regards,
    Marcelo
    P.S. I'm working on EP7 VC SP15

    Hi,
    If you'll create 2 iViews:
    1. Table connected to end point (all the fields are mapped and table selection mode is multiple)
    2. Table connected to start point with same fields.
    and create GP process for it, you'll find that selecting all the fields and passing them will result with all the selected fields appear in the 2nd iView.
    But, i don't know if you can pass the entire table automatically (without the user selecting all the records).
    Hope I helped,
    Shay

  • How 2 call BAPI & pass table name so that it will insert table data 2 SAP

    Hi guys,
    Has anyone tried calling BAPI from BODS; Please share screen shots and details. I want to call BAPI fron BODS which will take table name as a parameter and insert that table data to SAP.

    HI,
    in case you mean BusinessObjects Data Services with BODS then I would suggest you post your question into the EIM area of the SDN forums.
    Ingo

  • Passing table data to pl sql procedure oaf

    Hi All,
    I have a requirement where i have to pass table data to plsql procedure.
    In the first page i select the REQUISITION and click on RETURN button and it will take me to the next page.
    and in the Next page i will click on APPLY button.
    When i click on APPLY, it will call the procedure and will give input to the procedure whatever has been selected when i have selected requisition.
    Please help. Please tell me the approach how to get this task done. A sample code will work.
    Hope the requirement is clear.
    Thanks in Advance.

    Hi Chinmay,
    Refer below code for Your Requirement.
    //Code For Quering Data
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
    String Query = "SELECT organization_id FROM hr_operating_units WHERE organization_id = fnd_global.org_id";
    PreparedStatement stmt = conn.prepareStatement(Query);
    resultset=stmt.executeQuery();
    while (resultset.next())
    orgId = (String)resultset.getString("ORGANIZATION_ID").toString();
    conn.commit();
    catch(Exception e)
    e.printStackTrace();
    //Code for Pass Resulted column to Procedure Input for delete Particular Record
    Execute parameterized PL SQL procedure from OAF page
    Let us try to call PL/SQL package from OAF page. We will try to remove selected line from Database.
    Package Spec
    CREATE OR REPLACE PACKAGE APPS.genpack_pkg
    AS
    PROCEDURE roll_delete_proc (orgId IN VARCHAR2);
    END genpack_pkg;
    Package Body
    CREATE OR REPLACE PACKAGE BODY APPS.genpack_pkg
    AS
    PROCEDURE roll_delete_proc (orgId IN VARCHAR2)
    AS
    BEGIN
    DELETE FROM pklist_roll_details_temp
    WHERE roll_line_id = orgId;
    COMMIT;
    END roll_delete_proc;
    END genpack_pkg;
    //in Controller PFR
    import java.sql.CallableStatement;
    if (pageContext.getParameter("ActionsButton") != null)
    String val = pageContext.getParameter("ActionsChoice");
    if ("DELLN".equals(val))
    CallableStatement cstmt = null;
    for (OAViewRowImpl row = (OAViewRowImpl)tempvo.first(); row != null; row = (OAViewRowImpl)tempvo.next()) {
    if ((row.getAttribute("Selectflag") == null) ||
    (!row.getAttribute("Selectflag").toString().equals("Y"))) continue;
    try {
    int rollid = Integer.parseInt((String)row.getAttribute("orgId"));
    Connection conn = am.getOADBTransaction().getJdbcConnection();
    if (rollid == 1)
    temphm.put(row.getAttribute("orgId").toString(), row.getAttribute("PoNumber").orgId());
    tempvo.removeCurrentRow();
    else
    try
    StringBuilder sb = new StringBuilder();
    sb.append(rollid);
    String strI = sb.toString();
    System.out.println("Inside else in delete");
    cstmt = conn.prepareCall("{call GENPACK_PKG.tpc_roll_delete_proc(?)}");
    cstmt.setString(1, strI);
    System.out.println("Oracle Callable Statment Execution Init for Delete");
    cstmt.execute();
    catch (SQLException e) {
    throw new OAException(e.toString(), (byte)0);
    }tempvo.removeCurrentRow();
    catch (OAException e) {
    throw new OAException("No row selected", (byte)3);
    Thanks,
    Dilip

  • Temp Table within an Stored Procedure

    I'm pretty new to Oracle, but I have been developing in MS SQL for about 15. So I'm still getting use to the syntax and features within Oracle.
    I'm trying to create a stored procedure that has two temporary tables within it, and then queries both them tables and inserts the results into a table.
    I created the script but when they try to run in on the server it wont run. Can you guys tell me what I'm doing wrong?
    CREATE OR REPLACE PROCEDURE UpdateFIDB_SP IS BEGIN               CREATE GLOBAL TEMPORARY TABLE myAAAA         AS               (SELECT  AAAA.1111, AAAA.2222, BBBB.3333_EXT, CCCC.4444, DDDD.5555, DDDD.6666, DDDD.7777,                       DDDD.8888, AAAA.9999, EEEE.1010, EEEE.1A1A, EEEE.1B1B, FFFF.3333_LO, FFFF.1C1C,                       AAAA.1D1D               FROM mySchema.FFFF_07 FFFF               RIGHT OUTER JOIN mySchema.EEEE EEEE ON FFFF.9999 = EEEE.1B1B               RIGHT OUTER JOIN (                                 mySchema.DDDD DDDD                                 RIGHT OUTER JOIN mySchema.AAAA AAAA ON DDDD.1D1D = AAAA.1D1D                                 ) ON EEEE.PSPNR = AAAA.9999               LEFT OUTER JOIN mySchema.CCCC CCCC ON AAAA.3333 = CCCC.3333               LEFT OUTER JOIN mySchema.BBBB BBBB ON AAAA.3333 = BBBB.3333_INT               GROUP BY  AAAA.1D1D, AAAA.1111, AAAA.2222, BBBB.3333_EXT, CCCC.4444, DDDD.5555, DDDD.6666,                         DDDD.7777, DDDD.8888, AAAA.9999, EEEE.1010, EEEE.1A1A, EEEE.1B1B, FFFF.3333_LO,                         FFFF.1C1C         ON COMMIT DELETE ROWS);                         CREATE GLOBAL TEMPORARY TABLE myGGGG         AS             (SELECT  GGGG.1E1E, GGGG.1F1F, GGGG.1G1G, GGGG.1H1H, GGGG.1I1I, GGGG.1J1J,                     GGGG.1K1K, GGGG.R1D1D, GGGG.1L1L, GGGG.1M1M, GGGG.1N1N, GGGG.1O1O, GGGG.1P1P,                     GGGG.1Q1Q, HHHH.1R1R, IIII.1S1S, IIII.1T1T, IIII.1U1U, IIII.1V1V             FROM  mySchema.IIII IIII                   INNER JOIN mySchema.GGGG GGGG ON IIII.1K1K = GGGG.1K1K                   LEFT OUTER JOIN mySchema.HHHH HHHH ON GGGG.1L1L = HHHH.1W1W             WHERE ( GGGG.1M1M IN ('20', '30') )             AND   ( TO_DATE(IIII.1V1V, 'dd-mon-yyyy') = TO_DATE('31-DEC-9999','dd-mon-yyyy') )             AND ( TO_DATE(GGGG.1N1N, 'dd-mon-yyyy') >= TO_DATE('01-Jan-2011','dd-mon-yyyy') )         ON COMMIT DELETE ROWS);                 TRUNCATE TABLE FIDB;                 INSERT INTO FIDB (1111, 2222, 3333_EXT, 4444, 5555, 6666, 7777, 8888, 9999,                                   1010, 1A1A, 1B1B,3333_LO, 1C1C, 1D1D, 1E1E, 1F1F, 1G1G,                                   1H1H, 1I1I, 1J1J, 1K1K, R1D1D, 1L1L, 1M1M, 1N1N,                                   1O1O, 1P1P, 1Q1Q, 1R1R, 1S1S, 1T1T, 1U1U, 1V1V)            SELECT  myAAAA.1111, myAAAA.2222, myAAAA.3333_EXT, myAAAA.4444, myAAAA.5555, myAAAA.6666,                 myAAAA.7777, myAAAA.8888, myAAAA.9999, myAAAA.1010, myAAAA.1A1A, myAAAA.1B1B,                 myAAAA.3333_LO, myAAAA.1C1C, myAAAA.1D1D, myGGGG.1E1E, myGGGG.1F1F, myGGGG.1G1G,                 myGGGG.1H1H, myGGGG.1I1I, myGGGG.1J1J, myGGGG.1K1K, myGGGG.R1D1D,                 myGGGG.1L1L, myGGGG.1M1M, myGGGG.1N1N, myGGGG.1O1O, myGGGG.1P1P,                 myGGGG.1Q1Q, myGGGG.1R1R, myGGGG.1S1S, myGGGG.1T1T, myGGGG.1U1U, myGGGG.1V1V         FROM myGGGG INNER JOIN myAAAA ON myGGGG.R1D1D = myAAAA.1D1D         ORDER BY myGGGG.R1D1D;        COMMIT;     END;
    Thanks!

    Some people still sound mad at me because I have two queries and use temp tables
    Because in Oracle, unlike in sql server, you generally do not NEED temp tables at all.
    One of the biggest mistakes new Oracle developers make is to use PL/SQL when SQL will do the job just fine. Using PL/SQL when it isn't needed generally makes the code slower, less scalable and harder to maintain.
    One of the biggest mistakes sql server developers make when they use Oracle is to use temp table when they aren't needed. They try to write code in Oracle exactly the same way they wrote it in sql server. That creates temp tables that aren't needed, makes their code perform horribly and also makes it less scalable and harder to maintain.
    Oracle works differently and generally doesn't need ANY temp tables. You need to learn about how Oracle handles transactions and read consistency and how writers do NOT block readers and vice versa.
    Create a new thread and post FORMATTED code that shows the PROBLEM you are trying to solve and we can show you the proper way to solve it. That 'proper way' will likely NOT include any need for or use of temp tables.

  • Can I use Parallel execution for Global Temporary table within SP and How

    Dear Gurus,
    I have Global temporary table as below
    Create global temporary table Temp_Emp
    empno number,
    ename varchar2(20),
    deptno number
    ) on commit preserve rows;
    During processing I insert the data into this table and then fire query on Temp_Emp, get the data and pass it to front end.
    The SP as shown below
    Create or replace procedure get_emp_data
    empid in number,
    emp_detail out RefCsr -- Ref cursor
    as
    begin
    -- some code here
    open emp_detail for
    select *
    from Temp_Emp
    where empno = empid;
    end get_emp_data;
    Can use Parallel Query execution on Temp_Emp table and how ?
    i.e. do need to explicitly use parallel construct in query or is it default.
    Because I have many SQL like above (on global temporary tables) within Stored Procedures.
    Can anybody give me any suggestion.
    Thanking in Advance
    Sanjeev

    How come you are populating a temporary table and then opening a cursor on this temporary table for the front end to use?
    Couldn't you presumably just form a query out of the code you use to populate the temporary table? This is the recommended approach in Oracle.

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

Maybe you are looking for

  • File Dialog's start path input on PDA

    hello, I'm using the File Dialog function on a program executing on my PDA to prompt for a (new) directory path name.  I'd like to use the function's start path input so that the directory, by default, uses an existing directory on the PDA's memory c

  • This use has her Lync setup so that each Lync conversation is in it's own window

    With it set this way, if she is typing in one of the conversations & a new message comes up, she can no longer type in the message she was typing in.  Is there any way to fix that?

  • Subcontracting regularization after 180 days

    Dear Sir, We have a scenario where we had  sent a material for outside processing using SUBCONTRACTING PRCEDURE . We had done the following activities :    a) Created a Subcontract Purchase Order    b) Transfer the required Material to Vendor Stock  

  • Why doesn't photo stream work?  my photos do not get uploaded?

    my photos dont get uploaded to photo stream? why?it stopped uploading 2 weeks ago it is supposed to do it automatically once u have a wi fi connection ( or 3g )..

  • MAIL: Can sign, encrypt but not decrpyt

    After Mail was driving me crazy with weird error mesages, I deleted all my certificates and got the replaced by Versisign. I imported then and since then I can sign and encrypt mails from both of my accounts like charm. problem is: I can't decrypt a