Optional Out parameter

Is there a way to create a procedure where the out parameters are optional? Or an easy way to make believe it?

Looking at the code below, I want to be able to call fetch_t99 and be able to use one or more of the parameters "colX. The idea is that I don't have to write a function get_colX and while I don't have to make a dummy variable and have several lines of code space.

As a side note, the reason why because I am that I am did not back a rowtype is binds column return values to the elements of a form of the apex.
create table t99 
(
  t99_id number not null , 
  col1 varchar2(20),
  col2 varchar2(20), 
  col3 varchar2(20), 
  constraint t99_pk primary key 
  (
    t99_id 
  )
  enable 
);

insert into t99 values(1,'ONE','TWO','THREE');
commit;

create or replace procedure fetch_t99(
    p_t99_id in  t99.t99_id%type, 
    p_col1   out t99.col1%type,
    p_col2   out t99.col2%type, 
    p_col3   out t99.col3%type
)as
begin
    select col1, col2, col3
      into p_col1, p_col2, p_col3
      from t99
     where t99.t99_id = p_t99_id;
end fetch_t99;

declare
    l_t99_id t99.t99_id%type := 1; 
    l_col1   t99.col1%type;
    l_col2   t99.col2%type; 
    l_col3   t99.col3%type;
begin
    fetch_t99(
        p_t99_id => l_t99_id,
        p_col1   => l_col1,
        p_col2   => l_col2,
        p_col3   => l_col3
    );
    dbms_output.put_line('col1: ' ||l_col1 );
    dbms_output.put_line('col2: ' ||l_col2 );
    dbms_output.put_line('col3: ' ||l_col3 );
end;
Thank you
Tyson

Hi, Tyson,

No, you cannot make an optional OUT argument.
If the procedure is in a package, then you can Overload the procedure, i.e. to two (or more) separate procedures that have the same name, but different numbers and types of arguments. The usual way is to have a final version of the procedure (maybe the one with all the arguments) and have other procedures of the same name to call it.

In this case, I would create a procedure that didn't have a PARAMETER of type % ROWTYPE t99. No matter how many columns you want really, just to declare and to pass a VARIABLE, and simply to have a procedure.

Tags: Database

Similar Questions

  • Linked table filling out parameter is slow (2nd attempt)

    I have exactly the same problem as described in this thread archived: https://forums.oracle.com/thread/1096352.


    Can anyone tell why adding an OUT with the table binding parameter has such a negative effect on performance? We use Oracle.DataAccess v4.112.3.0.


    If I have to call the exactly the same stored procedure using OracleDataAdapter.Update (DataSet), it is 10 x faster than the use of the table binding.  And if I have to delete OUT parameter, then the binding table method is at least 5 times faster than OracleDataAdapter.Update (DataSet) in our case.


    Turns out that Oracle does not provide a way to set "fetch size" for the ExecuteNonQuery method with the table binding.  So when a stored procedure contains an OUT parameter (or function is the RETURN parameter), Oracle returns results of execution of each appellant separately.  This translates into a large number of General networks and slows down the process considerably.

    When you use Update() OracleDataAdapter with DataSet, the results of execution are sent in batches, resulting in fresh low networking overhead.

    Without THE params, there is no problem since nothing is sent to the appellant and to ExecuteNonQuery with table binding works faster than OracleDataAdapter.Update (DataSet).

  • Sample using XMLTYPE out parameter

    Hi all

    plenty of examples of using ODP.NET and XMLTYPE out parameter source code?

    PROCEDURE OBTENER_DATOS_DESPLIEGUE (pPROYECTO IN VARCHAR2,

    pETIQUETA IN VARCHAR2 DEFAULT NULL,

    pMOMENTO OUT TIMESTAMP,

    XMLTYPE OUT pDATOS)

    And for testing: function and procedure.


    FUNCTION FRKDATA_GET_XMLTYPE(num IN NUMBER, xml1 IN XMLTYPE) RETURN XMLTYPE IS
      xmlout XMLTYPE;
      BEGIN
      SELECT XMLTYPE_COL
      INTO xmlout
      FROM POC_TEST_XML_TABLE
      WHERE NUM_COL = num;
      RETURN xmlout;
      END FRKDATA_GET_XMLTYPE;


    PROCEDURE FRKDATA_TESTXML(qry in VARCHAR2, rslt OUT XMLTYPE) AS
    BEGIN
    rslt := dbms_xmlgen.getxmltype(qry);
    END FRKDATA_TESTXML;


    See https://entlib.codeplex.com/discussions/454750

    I get an error "the connection is closed.

    Only, I found this example, but without OUTPUT parameters.

    /*
    create or replace function xmlproc(v1 in xmltype) return xmltype is
    begin
    return v1;
    end;
    /
    */

    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;

    class Program
    {
        static void Main(string[] args)
        {
            using (OracleConnection con = new OracleConnection())
            {
                con.ConnectionString = "user id=scott;password=tiger;data source=orcl";
                con.Open();
                using (OracleCommand cmd = new OracleCommand("",con))
                {
                    cmd.CommandText = "xmlproc";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new OracleParameter("return", OracleDbType.XmlType)).Direction = ParameterDirection.ReturnValue;
                    cmd.Parameters.Add(new OracleParameter("v1", OracleDbType.XmlType)).Direction = ParameterDirection.Input;
                    cmd.Parameters["v1"].Value = "<a>b</a>";
                    cmd.ExecuteNonQuery();
                    Console.WriteLine(((OracleXmlType)cmd.Parameters["return"].Value).Value);
                }
            }
        }
    }

    The below works for me.

    -------------

    PROCEDURE "XMLPROC")

    'PARAM1' OUT XMLTYPE) IS

    BEGIN

    Param1: = dbms_xmlgen.getxmltype ("SELECT name of EMPLOYEES WHERE EMPLOYEE_ID is 100');.

    END;

    -------------

    Con OracleConnection = new OracleConnection();
    con. ConnectionString = conString;
    con. Open();
    OracleCommand cmd = con. CreateCommand();
    cmd.CommandText = "xmlproc;

    cmd.CommandType = CommandType.StoredProcedure;

    cmd. Parameters.Add (new OracleParameter ("xmlout", OracleDbType.XmlType)). Direction = ParameterDirection.Output;

    cmd ExecuteNonQuery());

    Console.WriteLine (((OracleXmlType) cmd.)) Parameters ["xmlout"]. (Value). (Value);

  • Syntax of APEX_PLSQL_JOB. SUBMIT_PROCESS with an OUT parameter

    Hi all
    I use APEX_PLSQL_JOB. SUBMIT_PROCESS and call a procedure that has both an and an OUT parameter.

    The parameter works very well; I can call my APEX procedure and pass it the: point APP_JOB as a parameter. The OUT parameter, that I can't make it work. I can call my procedure in a different block in SqlDeveloper and everything works, so I am sure that my code of procedure is correct. I can not get the OUT parameter returned by APEX.

    This is the code plsql I call APEX dynamic action:
    DECLARE
      l_sql      VARCHAR2(4000);
      l_instance VARCHAR2(30);
       l_job number;
      l_rows_processed number;
    
    BEGIN
    l_instance := :P9_INSTANCE;
      l_sql      := 'BEGIN update_tl_tables_1(:APP_JOB, :F103_ROWS_PROCESSED); END;';
      l_job      := APEX_PLSQL_JOB.SUBMIT_PROCESS( p_sql => l_sql, p_status => 'Background process submitted');
    
    l_rows_processed := :F103_ROWS_PROCESSED;
    insert into gse_lng_jobs (instance, job_id, rows_processed) values (l_instance, l_job, l_rows_processed);
    COMMIT;
    END;
    My procedure is created as:
    create or replace
    procedure UPDATE_TL_TABLES_1 (l_app_job IN number, l_rows_processed OUT number)
    IS......
    Again, this works very well for SqlDeveloper. Can someone suggest the correct plsql code? I tried this, use a page element, an element of system etc and not luck. I first tried just passing my procedure a local variable as l_rows_processed, but the procedure wouldn't even run, so I guess that the API needs a real element of APEX, but I'm running out of ideas here.

    Thanks in advance,
    John

    It won't work because the job has not yet running when you perform the insertion. So: F103_ROWS_PROCESSED does not contain something useful.

    Why don't you try make insertion as part of employment, for example

    l_sql: = ' BEGIN update_tl_tables_1 (: APP_JOB,: F103_ROWS_PROCESSED); insert into gse_lng_jobs (instance, job_id, rows_processed) values ("' | l_instance |") ', ' || l_job |',: F103_ROWS_PROCESSED); END;';

    .. .quelquechose like this.

  • the size of the out parameter in the procedure

    Hi all:

    I have a procedure in a pl/sql package like this:
    create or replace procedure MyProc (PRM_STR in VHARCHAR2, PRM_OUTSTR OUT VARCHAR2) is
    V_TEST VARCHAR2 (100)
    Start
    +...+
    V_STR: = SUBSTR (PRM_STR, 22, 31);
    V_TEST: = TRIM (V_STR);
    PRM_OUTSTR: = V_TEST;
    EXCEPTION
    WHILE OTHERS THEN
    +....+
    myproc end;

    When I run it, it always gives me an exception: ORA-06502: PL/SQL: digital or value error: character string buffer too small.
    Then I debug him:
    V_TEST: = TRIM (V_STR)
    is OK.
    While PRM_OUTSTR: = V_TEST, it throws this exception.

    I was confused, the out parameter in the procedure has a size? How can I set it?

    Please help me!
    Thank you very much!

    You must declare the size of the variable you use in the call to the procedure to be big enough.

    The output parameter itself may not be declared with a size:

    for example

    Your appeal should be something like the following:

    declare
    v_prmstr varchar2(4000)  :=  'Your input value';
    v_prmoutstr varchar2(4000);
    begin
    myproc(v_prmstr,v_prmoutstr) ;
    end;
    

    v_prmoutstr must be reported to be large enough to contain the value returned by the parameter
    PRM_OUTSTR

    added example variable
    Published by: Keith Jamieson on August 11, 2011 13:32

  • 'OUT' parameter is declared but never used

    Hello
    I created a package.that is given below.

    CREATE OR REPLACE PACKAGE Pkg_Sam_Ref_Cursr
    IS
    TYPE pa_sam_details_recrd IS RECORD (EMPNO number 4);
    TYPE pa_sam_details_cursr IS REF CURSOR RETURN pa_sam_details_recrd;
    END;

    and I created a function.that is given below

    CREATE OR REPLACE FUNCTION FunSam_Report)
    p_empno NUMBER
    )
    RETURN Pkg_Sam_Ref_Cursr.pa_sam_details_cursr
    IS
    data_cursr Pkg_Sam_Ref_Cursr.pa_sam_details_cursr;
    BEGIN
    Data_cursr OPEN to select A.* from Emp A where A.Empno = A.Deptno order p_empno;

    RETURN DATA_CURSR;
    END;

    and created a stored procedure.that is given below

    CREATE or replace PROCEDURE SP_SampleSP)
    P_EMPNO NUMBER,
    OUT Pkg_Sam_Ref_Cursr.pa_sam_details_cursr) IS data_cursr Pkg_Sam_Ref_Cursr.pa_sam_details_cursr;
    BEGIN
    data_cursr: = FunSam_Report (P_EMPNO);
    END;

    at compile time it will throw the following error but sp is created and how to see the result.

    Error: Hint: 'OUT' parameter is declared but never used in "SP_SampleSP".
    Line: 3
    Text: OUT Pkg_Sam_Ref_Cursr.pa_sam_details_cursr) IS data_cursr Pkg_Sam_Ref_Cursr.pa_sam_details_cursr;

    Error: Hint: value of 'data_cursr' in 'SP_SampleSP' never used
    Line: 5
    Text: data_cursr: = FunSam_Report (P_EMPNO);
    CREATE or replace PROCEDURE SP_SampleSP (
           P_EMPNO IN NUMBER,
           data_cursr OUT Pkg_Sam_Ref_Cursr.pa_sam_details_cursr)
    IS
    BEGIN
       data_cursr:= FunSam_Report(P_EMPNO);
    END;
    
  • How to run a procedure created dynamically with out parameter

    Hi guys,.

    a friend I need to run a procedure whose name will change dynamically and this procedure is with 2 out parameter. I need to capture the value of these 2 output settings, here I m giving my code too...

    declare
    int v_emp_id: = 100013;
    p_reg_off varchar (5): = "R";
    int p_user_id: = 6;
    v_status varchar (200);
    v_message varchar (200);
    v_Formula varchar (100);
    int v_number: = 1;

    Start
    v_Formula: = 'call testsp_ | v_number | ' ('| v_emp_id |', "'| p_reg_off |") «, » || p_user_id | v_status, v_message)';
    DBMS_OUTPUT. Put_line (v_Formula);
    immediately run v_Formula;
    end;


    and my procedure structure is like this


    CREATE OR REPLACE PROCEDURE testsp_1
    (
    p_emp_id INT,
    p_reg_off TANK,
    p_user_id INT,
    p_status OUT NOCOPY INT,
    p_message OUT NOCOPY VARCHAR2
    )
    AS
    Start
    end;

    Please help me...

    Hello

    You must use the "USING" clause to execute dynamic sql with parameter out.

    Example: http://download-west.oracle.com/docs/cd/B28359_01/appdev.111/b28370/dynamic.htm

    Arun-

  • Wander, call from java to sql pl with table out parameter procedure

    Hello
    Please help me? It is urgent for me...
    My Oracle's Code is like this,

    CREATE TABLE TEST_TABLE ( DATE1 DATE, VALUE_EXAMPLE VARCHAR2(20 BYTE), VALUE2_EXAMPLE VARCHAR2(20 BYTE), VALUE3_EXAMPLE NUMBER ); CREATE OR REPLACE TYPE TONERECORDTEST AS OBJECT ( DATE1 DATE, VALUE_EXAMPLE VARCHAR2(20), VALUE2_EXAMPLE VARCHAR2(20), VALUE3_EXAMPLE NUMBER ); CREATE OR REPLACE TYPE TTESTTABLE IS TABLE OF TONERECORDTEST; CREATE OR REPLACE PACKAGE test_collection_procedures AS PROCEDURE testCallProcedureFromJava(start_time IN DATE, end_time IN DATE, table_data OUT TTesttable); END test_collection_procedures; / CREATE OR REPLACE PACKAGE BODY test_collection_procedures AS PROCEDURE testCallProcedureFromJava(start_time IN DATE, end_time IN DATE, table_data OUT TTesttable) IS BEGIN SELECT TONERECORDTEST(date1, value_example, value2_example, value3_example) BULK COLLECT INTO table_data FROM TEST_TABLE WHERE DATE1>=start_time AND DATE1<=end_time; END testCallProcedureFromJava; END test_collection_procedures;

    And it's like my Java Code

    import java.sql.Connection; import java.sql.DriverManager; import oracle.jdbc.OracleCallableStatement; import oracle.jdbc.OracleTypes; import oracle.sql.ARRAY; import oracle.sql.ArrayDescriptor; import oracle.sql.STRUCT; import oracle.sql.StructDescriptor; public class testPLCollectionType { public static void main(java.lang.String[] args) { try{ //Load the driver Class.forName ("oracle.jdbc.driver.OracleDriver"); // Connect to the database Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@serverbd:1521:squema1","user", "password"); // First, declare the Object arrays that will store the data (for TONERECORDTEST OBJECT TYPE) Object [] p2recobj; Object [] p3recobj; Object [] p4recobj; // Declare the Object Arrays to hold the STRUCTS (for TTESTTABLE TYPE) Object [] p2arrobj; // Declare two descriptors, one for the ARRAY TYPE // and one for the OBJECT TYPE. StructDescriptor desc1=StructDescriptor.createDescriptor("TONERECORDTEST",conn); ArrayDescriptor desc2=ArrayDescriptor.createDescriptor("TTESTTABLE",conn); // Set up the ARRAY object. ARRAY p2arr; // Declare the callable statement. // This must be of type OracleCallableStatement. OracleCallableStatement ocs = (OracleCallableStatement)conn.prepareCall("{call test_collection_procedures.testCallProcedureFromJa va(?,?,?)}"); // Declare IN parameters. Realize that are 2 DATE TYPE!!! Maybe your could change with setDATE ocs.setString(1,"01-JAN-04"); ocs.setString(2,"10-JAN-05"); // Register OUT parameter ocs.registerOutParameter(3,OracleTypes.ARRAY,"TTESTTABLE"); // Execute the procedure ocs.execute(); // Associate the returned arrays with the ARRAY objects. p2arr = ocs.getARRAY(3); // Get the data back into the data arrays. //p1arrobj = (Object [])p1arr.getArray(); p2arrobj = (Object [])p2arr.getArray(); System.out.println("Number of rows="+p2arrobj.length); System.out.println("Printing results..."); for (int i=0; i<p2arrobj.length; i++){ Object [] piarrobj = ((STRUCT)p2arrobj).getAttributes();
    System.out.println();
    System.out.print("Row "+i);
    for (int j=0; j<4; j++){
    System.out.print("|"+piarrobj[j]);
    }
    }

    }catch (Exception ex){
    System.out.println("Exception-->"+ex.getMessage());
    }
    }

    }
    Actually when i running the java program it is showing error
    Exception-->ORA-06550: line 1, column 58:
    PLS-00103: Encountered the symbol "VA" when expecting one of the following:

    := . ( @ % ;
    The symbol ":=" was substituted for "VA" to continue.
      I am not getting the error .Please help me out Dhabas Edited by: Dhabas on Jan 12, 2009 3:49 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    // Declare the callable statement.
    // This must be of type OracleCallableStatement.
    ..."{call test_collection_procedures.testCallProcedureFromJa va(?,?,?)}");
    

    Looks like divorced Ja's.

  • Appeal procedure in another procedure using the Out parameter slider - lesson

    Hello

    I am new to Oracle development so first I wonder if it is a good place with a simple way of the of on how to create stored procedures?  I'm looking for the most part at this stage for a quick read.

    Second, currently have hacked and slashed my way into getting one built.  It has 3 parameters and an output parameter sys_refcursor.  This procedure works.

    I want to have another created procedure that will call the above procedure and loop through each row in the setting out and write to a file.  Can someone point me to an example of this by any chance?

    Thanks for the help.

    Hello

    e28d78d3-c6c6-4BCE-b14f-0f6bf26fa17c wrote:

    Thanks for the reply.

    Here's what I have, but I'm getting many errors.  When I seem to fix one that I get a new one. Kind of like what it show me all questions vs one question at a time.  I never know if I create another error of my attempts at fixing what, in my view, could be the problem.  In any case, something to get used to.

    When you do any type of programming, take baby steps.  Write less code as possible, test what you wrote ' worm and, if it contains errors, correct them and test again.

    The PL/SQL compiler tries to show all errors, but often it is impossible to say what is a separate mistake, and which is a consequence of a previous error.  For example, the DECLARE statements in your code are perfectly valid PL/SQL statements, but they are the mistakes in the sense that they are not what you think, and you may not use them.  PL/SQL does not know that (I don't really know that, either, but I'm willing to guess in this case).  The works of compiler on the explanation that you really wanted to say SAID, until what it becomes obvious, maybe several lines later, that something makes no sense, but at this time, there is no way he could say that the undesirable DECLARE was the cause.

    So here is where I am stuck currently.  What I want should first, run the stored procedure and I think I do as you suggest.  Which returns data in the output parameter, which is of type sys_refcursor.  I think I would need to loop through each element that cursor and output to the file using the dbms_output you reference and like I did below.  This should be it.  Sounds simple enough, but it's where some of the basics for me.

    For example, by creating the procedure some examples have the name of the procedure and then some "AS", "IS".  When use the beginning and the end and when not I need?

    There is no difference betwwen

    CREATE PROCEDURE... AS and

    CREATE PROCEDURE... Use IS the one you prefer.  You must always one or the other, however.

    PL/SQL is written in blocks.  The basic structure of a block is

    DECLARE - optional, sometimes involved

    ...

    BEGIN

    ...

    -Optional EXCEPTION; forget it for now

    ...

    END;

    Almost all of the PL/SQL code is part of a block.  In fact, you could argue that anything not in a block isn't really PL/SQL.  (For example, CREATE PROCEDURE is really an SQL, PL/SQL not, it indicates the SQL that some PL/SQL compiler is coming.)

    You should always BEGIN and END keywords in a PL/SQL block; None is never optional.

    I think I'm doing the for loop correctly but I get an error on the portion of loop-end.  It is a part of these simple things that become I think that.

    That's what I have:

    CREATE OR REPLACE PROCEDURE APPS.boact_report_3

    AS

    DECLARE v_cur SYS_REFCURSOR;

    DECLARE v_file_out UTL_FILE.file_type;

    BEGIN

    I said earlier, DECLARED may be implied.  It's one of those places if there is nothing after CREATE PROCEDURE... IS and before STARTING, it is supposed to be a statement.

    You can have as many statements (0, 1, 2 or more) that you want in this section of the statement.  The semicolon at the end of each of them is all the separation you need each other; you don't need any keyword as STATED.

    Open the v_cur for

    bo_report (p_sv_id, p_start_date, p_end_date, out v_cur);  -stored procedure that girls v_cur witch is a sys_refcursor parameter.  It works

    END;

    BEGIN

    Don't forget, how to call a procedure is

    bo_report (x, y, z);

    not

    bo_report (x, y, z OUT);

    The key words are only necessary (and only used) in the declaration of a procedure, not in his appeal.  When you create a procedure, you decide if each argument is going to be an argument IN, an OUT argument, or IN OUT argument, and you tell the compiler that you decide.  When you call a procedure, you have no choice; each argument is IN, OUT or IN OUT has already been decided, and suffice to say compiling what are the variables (or expressions) that you use to play these predetermined roles.

    Dbms_output.put_line ('Date: ');

    v_file_out: =.

    UTL_FILE.fopen (' / public/scripts/smorau02 ', 'w_act.csv', 'W');

    FOR x IN v_cur

    LOOP

    () UTL_FILE.put_line

    v_file_out,

    x.cl_num | ','

    || x.wa_id | ','

    || x.Description | ','

    || x.a_date | ','

    || x.a_by | ','

    || x.v_Name | ','

    || x.SITE_NAME | ','

    || x.stage | ','

    || x.in_queue);

    END LOOP;

    UTL_FILE.fclose (v_file_out);

    END;

    Thanks again for the help.

    You have not to send the code to bo_report, so I can't run the procedure.  I do not notice any obvious mistakes immediately superior.

  • New SDK and Simulator installed, BUT impossible to deploy on Simulator... Simulator Option out - sail Buritto OSX

    Hey guys,.

    I installed the new 1.0.1 SDK and Simulator without problems...

    In my prefs Burrito... I chose BlackBerry Tablet OS and change 0.94 path to the 1.0.1 folder sdk...

    When I try to set up the debug configuration... I can only run my application locally... Cannot select the option Simulator... It is unselectable and greyed out

    See this screen below:

    Is there something I'm missing here? Thanks in advance.

    Never mind... It's been a while since I deployed Simulator... You must click the radio button device... to select the Simulator... Who is intuitive?

  • Error 'Missing IN or OUT parameter to the index' ODI

    Hello

    Im trying to load the data of several Oracle DB data sets for Oracle table and I get the following error:


    "ODI-1228: CAPEX (Export) has failed on the target of ORACLE DEV connection transit area."

    Caused by: java.sql.SQLException: parameter IN or OUT to missing index: 3 "

    This error pops up when loading the data from each data set temporary tables (C$ _0CAPEX...) C$ _4CAPEX) in a general temporary table (C$ _CAPEX). The LKM that im using is SQL to SQL

    Capture.PNGCapture2.JPG

    I think the problem might be related to "target_code" generated by the ODI on this step,

    Insert into C$ _CAPEX

    (

    CUENTA, PERIODO, ANIO, STAGE, F_SOLICITANTE, PROYECTO0, VERSION, AFC, DATA

    )

    values

    (

    : ACCOUNT,: PERIODO, : SP2F. Anio,: STAGE,: F_SOLICITANTE,: PROYECTO0,: VERSION: AFC,: DATA

    )

    Please provide us with your valuable answers.

    Concerning

    Thank you KK and Tina Wang for your answers,

    I found that one of the variables ODI (SP2F. Anio) I was using on a filter had the same name of a (Anio) column of the target table. In view of the comment KK, I tried to pass this filter to the staging, but the problem persisted.

    Just in case anyone has the same problem that I changed the name of the ODI "Anio" variable to another name and now the flow runs without error.

    Concerning

  • Ref Cursor as an out parameter.

    Hi all
    Please help me with this.

    It is a small procedure where the ref cursor is used as output parameter.
    create or replace
    PROCEDURE P_REFCURSOR_OUT 
    (P_DEPTNO    IN  EMP.DEPTNO%TYPE,
    P_RECORDSET OUT SYS_REFCURSOR) AS 
    BEGIN 
          OPEN P_RECORDSET FOR
          SELECT EMPNO,
          EMPNM,
          DEPTNO
          FROM   EMP
          WHERE  DEPTNO = P_DEPTNO
          ORDER BY EMPNM;
    END P_REFCURSOR_OUT;
    There is another procedure that calls the procedure above. But during the call, it is throwing an exception that ORA-01722. What's not here? Help, please.
    CREATE OR REPLACE PROCEDURE P_CALL_REFCURSOR_OUT AS
      L_CURSOR  SYS_REFCURSOR;
      L_EMPNM   EMP.EMPNM%TYPE;
      L_EMPNO   EMP.EMPNO%TYPE;
      L_DEPTNO  EMP.DEPTNO%TYPE;
    BEGIN
      P_REFCURSOR_OUT (P_DEPTNO    => 1000,
                  P_RECORDSET => L_CURSOR);
                
      LOOP 
        FETCH L_CURSOR
        INTO  L_EMPNM, L_EMPNO, L_DEPTNO;
        EXIT WHEN L_CURSOR%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(L_EMPNM || ' | ' || L_EMPNO || ' | ' || L_DEPTNO);
      END LOOP;
      CLOSE L_CURSOR;
    END P_CALL_REFCURSOR_OUT;
    Kind regards
    BS2012

    The cursor that you open selects the EMPNO and DEPTNO EMPNM in that order.
    When you retrieve the cursor, you get in L_EMPNM, L_EMPNO, L_DEPTNO.

    It would seem that the first two columns have been inverted in your FETCH statement. Assuming that EMPNO is a NUMBER EMPNM is a VARCHAR2, this means Oracle trying implicitly converted to the EMPNM in a NUMBER that is causing the error.

    If you change the order of the variables in your FETCH statement, the error should disappear

        FETCH L_CURSOR
        INTO   L_EMPNO, L_EMPNM, L_DEPTNO;
    

    Justin

  • How to get a select statement to pass a variable as the OUT parameter in PROC

    I have the underside of the nested select statement that returns the name of the missing table (data_table_name).

    How to be an effective way to modify the select statement, so that the returned 'data_table_name' is passed as OUTPUT in a procedure parameter
    select 'Missing Table Name : ' || data_table_name
         from   ( select upper(data_table_name) data_table_name
                  from   TABLE1
                  where  data_table_name in ('ABC',EFG','XYZ')
                MINUS
              ( select upper(fus_data_table_name)
                from   TABLE2
                where  fus_data_table_name in ('EFG',')
              group by
                     upper(fus_data_table_name)
              union
              select upper(fus_data_table_name)
              from   TABLE2
              where  fus_data_table_name = 'LMN'
              group  by
                     upper(fus_data_table_name)
            ));
    Any help is greatly appreciated.

    S
    CREATE OR REPLACE PROCEDURE myproc (tname OUT NOCOPY VARCHAR2) AUTHID CURRENT_USER IS
    BEGIN
      SELECT something
      INTO tname
      FROM whatever;
    EXCEPTION
      WHEN OTHERS THEN
        tname := ;
    END myproc;
    /
    
  • How to deal with Missing IN or OUT parameter to the index: 2

    When I click on the query button Search I got this error message "error".
    Parameter IN or OUT to missing index: 2 ". Please show me the way which address them.

    Concerning
    KT

    Thank you all,

    I used the query with parameters for the search and when I removed view viewcriteria, this error message "missing IN or Out the setting to index::2. is never show again.but, If I used both bind variables and display the error message of query criteria in my opinion came every time.

    Concerning
    KT

  • Missing IN or OUT parameter to the Index: 1

    Hi all
    I write code for research, I have the batch ID code and customer I find with BatchID successfulyy, but I can't search by client code.
    When I am looking with customer_code I got below exception.
    He showed: # # 0 in detail
    java.sql.SQLException: parameter IN or OUT to missing index: 1
    My query is:
    Select distinct
    CUSTOMER_CODE
    TRADER_ID
    CUSIP
    TRADE_DATE
    TRADE_STATUS
    HOW_TRADE_CREATED
    SETTLEMENT_DATE
    BS
    QUANTITY
    TRADE_PRICE
    WHEN_ISSUED
    PRINCIPAL_AMOUNT
    ACCRUED_INTEREST
    COMMISSION
    FINAL_MONEY
    TRADE_ID
    STARTTIME
    HUB
    STATE
    TENOR
    IS_AGGRESSOR
    HUB_TRADE_ID
    SUB_FUND
    TXN_STG_ID
    PROCESS_FLAG
    BATCH_ID
    CREATION_DATE,
    CREATED_BY
    LAST_UPDATE_DATE
    LAST_UPDATED_BY
    LAST_UPDATE_LOGIN
    TRANSACTION_TYPE
    ERROR_MESSAGE
    order_number
    OF XXCURRNX. XXCUR_TRADE_STG_HIST XXSTR
    WHERE XXSTR. BATCH_ID = NVL (: 1, XXSTR.) BATCH_ID)
    and XXSTR. CUSTOMER_CODE = NVL (: 2, XXSTR.) CUSTOMER_CODE)

    and search Code is:
    ' Public Sub srchCustlinedtls (pageContext OAPageContext, OAWebBean webBean)
    {

    XxcustordhistVOImpl srchVO = getXxcustordhistVO1 ();
    String vcustid = null;
    int f = 0;

    If (pageContext.getParameter ("BatchID")! = null & &! pageContext.getParameter("BatchID").equals(""))
    {
    String BchID = pageContext.getParameter ("BatchID");
    int vInBtchID = Integer.parseInt (BchID);
    srchVO.setWhereClauseParams (null);
    srchVO.setWhereClauseParam(0,vInBtchID);
    System.out.println ("the package ID is:" + vInBtchID);
    f = 1;
    } else
    {
    srchVO.setWhereClauseParam(0,null);
    }

    If (pageContext.getParameter ("CustmeCode")! = null & &! pageContext.getParameter("CustmeCode").equals(""))
    {
    System.out.println ("I'm code im client");
    String vCustID = pageContext.getParameter ("CustmeCode");
    srchVO.setWhereClauseParams (null);
    srchVO.setWhereClauseParam(1,vCustID);
    System.out.println ("client code is" + vCustID);
    f = 1;
    } else
    {
    srchVO.setWhereClauseParam(1,null);
    }
    if(f==1)
    {
    srchVO.executeQuery ();
    }
    on the other
    {
    throw new OAException ("Please select at least one criteria", OAException.WARNING of research);
    }
    }

    can you please review this time.
    Thank you

    Hello

    DNT together

    srchVO.setWhereClauseParams (null);

    Concerning
    Meher Irk

Maybe you are looking for