I can pass a pl/sql table as a parameter for a database adapter

Hello

I'm moving mutiple files back to a pl/sql stored procedure using a BPEL database adapter. Does anyone know if it is possible to make pl/sql tables to bpel as a parameter?

The version of the database that we use is 8.1.7 and so I do not think that we use XMl types for transmitting data.

Yes you can not spend the function PL/SQL nested tables in JDBC. You can pass simple values such as VARCHAR2, NUMBER and Oracle SQL object types (VARRAY, nested TABLE, OBJECT).

Types defined in PL/SQL are simply not supported by the JDBC driver (except the basic support for the index per table, but 1 level of depth). PL/SQL types are not very good to use, because then you can not use them in SQL in PL/SQL statements, SQL types do not have these limitations.

Tags: Fusion Middleware

Similar Questions

  • Can pass us a Collection (table) to a procedure in another package

    Hi all

    I have a package in which I have a collection (array of user-defined records).
    I filled it with some values.
    Now, I want to write a procedure in a centralized set B to display these values.
    I created the same type and table B package.
    Now, I want to move the collection from Package to package B procedure and display these values. (I don't want to have that in A Package B package is our centralized support package).
    When I do if I get the following error


    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    1899/8 PL/SQL: statement ignored
    1899/8 PLS-00306: wrong number or types of arguments in the call to
    'DISPLAY_OUTPUT1 '.


    I can't past collection like that even if I said the same kind of collection in package B to receive the Package A collection?

    Thank you
    Pramod Garre

    Hello

    Make the type in the package, a global variable and
    Try to declare the type in packageB as packageA.yourtype%type.

    G.

  • Pass Pl/sql table in the USING clause in the EXECUTE IMMEDIATE statement

    Getting error when I try to pass the PL/SQL table in the USING clause in the EXECUTE IMMEDIATE statement:

    Declare
    result NUMBER;
    TYPE values_tab IS TABLE OF NUMBER INDEX OF directory;
    lv_tab values_tab;
    lv_exp varchar2 (300);
    lv_exec varchar2 (300);
    BEGIN
    lv_tab (1): = 5;
    lv_tab (2): = 48;
    lv_tab (3): = 7;
    lv_tab (4): = 6;
    lv_exp: = ': + b1: b2 + (: b3 *: b4)';
    lv_exec: = 'SELECT'. lv_exp | ' THE DOUBLE '.

    IMMEDIATE EXECUTION
    lv_exec
    IN
    result
    USING
    lv_tab;
    DBMS_OUTPUT. Put_line (result);

    END;
    /

    Error on line 1
    ORA-06550: line 20, column 12:
    PLS-00457: expressions must be SQL types
    ORA-06550: line 15, column 8:
    PL/SQL: Statement ignored


    I am trying to evaluate the expression ': + b1: b2 + (: b3 *: b4) "which is stored in the table. This table has different expressions (expressions about 300). I want to use the bind variable in the expression because each expression evaluated thousands of time may be more in some cases. If I use bind variable can he fill pool.

    Is there a way I can pass parameters with the HELP of (IN) dynamically instead of write "help lv_tab (1), lv_tab (2), lv_tab (3), lv_tab (4)? As number of change of the input parameters depend on the expression in the table.

    If it is possible please suggest any other ideas/approaches

    Help, please...

    Published by: satnam on June 11, 2009 11:50

    Well, you keep changing faster reqs that I can follow. In any case, assuming that N-th variable bind (left to right) corresponds to n-th collection item:

    Declare
        result NUMBER;
        lv_tab values_tab := values_tab();
        lv_exp varchar2(300);
        lv_exec varchar2(300);
        lv_i number := 0;
    BEGIN
        lv_tab.extend(4);
        lv_tab(1) := 5;
        lv_tab(2) := 48;
        lv_tab(3) := 7;
        lv_tab(4) := 6;
        lv_exp := ':5000135+:5403456+(:5900111*:5200456)';
        lv_exec := lv_exp;
        While regexp_like(lv_exec,':\d+') loop
          lv_i := lv_i + 1;
          lv_exec := REGEXP_REPLACE(lv_exec,':\d+',':b(' || lv_i || ')',1,1);
        end loop;
        lv_exec := 'BEGIN :a := ' || lv_exec || '; END;';
    DBMS_OUTPUT.PUT_LINE(lv_exec);
    EXECUTE IMMEDIATE lv_exec USING OUT result,IN lv_tab;
    DBMS_OUTPUT.PUT_LINE(result);
    END;
    /
    BEGIN :a := :b(1)+:b(2)+(:b(3)*:b(4)); END;
    95
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • Help with PL/SQL table

    Hi all

    Newbie when it comes to PL/SQL tables...

    Can someone explain to me why it works and how exactly I can do the following without triggering an error?

    I have a function that accepts a PL/SQL table like in parameter.

    The PL/SQL table is defined as...
    Type TTimeTable is table of xxtzg_otl_iface_stg%rowtype index by binary_integer;
    the xxtzg_otl_iface_stg table has many columns including error_message and error_flag. If I find an error, I want to update the error_message and error_flag function. If I can get it works I will then modify the function to return to the table of PL/SQL instead of BOOLEAN
    FUNCTION validate_timecard (pTimeTable IN TTimeTable
                                                 ) RETURN BOOLEAN IS
    
      lc_module            CONSTANT VARCHAR2(25)        := 'validate_timecard';
      lEmployeeCount    PLS_INTEGER;
      lEmployeeError     VARCHAR2(1000);
      lErrorCount          PLS_INTEGER :=0;
      
      BEGIN
    
         FOR i IN 1 .. NVL(pTimeTable.COUNT,0) LOOP                                   
                                             
         xxtzg_concurrent_utils_pkg.write_log(  p_package =>  gc_package
                                                                , p_module  =>  lc_module
                                                                , p_text    =>  'Processing timecard for employee_number: '||pTimeTable(1).employee_number
                                                               );               
       
         -- Call validations before submitting the timecard to the API
         --validate employee
    
            begin
               select count(*)
                 into lEmployeeCount
                 from per_all_people_f
                where employee_number = pTimeTable(1).employee_number;
                
                if lEmployeeCount = 0 then
                
                -- Set the errors
    
                -- This assignment below does not work, I get an error message saying...
                --[Error] PLS-00363 (137: 27): PLS-00363: expression 'PTIMETABLE.ERROR_MESSAGE' cannot be used as an assignment target
    
                PTimeTable(i).error_message :=  'Employee Number '||pTimeTable(1).employee_number||' is not a valid employee';
                PTimeTable(i).error_flag := 'Y';
    
                end if;
                
            end;    
            
         END LOOP; 
         
         IF lErrorCount = 0 THEN 
         RETURN TRUE;
         ELSE
         RETURN FALSE;
         END IF;
                                               
      END;

    blue72TA wrote:

    FUNCTION validate_timecard (pTimeTable IN TTimeTable
    ) RETURN BOOLEAN IS
    ...
    
    -- This assignment below does not work, I get an error message saying...
    --[Error] PLS-00363 (137: 27): PLS-00363: expression 'PTIMETABLE.ERROR_MESSAGE' cannot be used as an assignment target
    
    PTimeTable(i).error_message :=  'Employee Number '||pTimeTable(1).employee_number||' is not a valid employee';
    PTimeTable(i).error_flag := 'Y';
    

    Your table is declared as IN only (the default if you do not explicitly set it), so you are not allowed to change its attributes in all respects, IN = read-only.

    If you want to be able to modify the values of a parameter, it must be declared as OUT parameters.

  • Nested PL/sql tables passing of ADF

    Hi all

    I'm moving a nested pl/sql table parameter of adf for the stored procedure.

    I have the following code to bind the variable in my AMImpl

    ArrayDescriptor desc = ArrayDescriptor.createDescriptor ("STATION_FEATURES_T", st.getConnection ());

    TABLE array = new ARRAY (desc, st.getConnection (), stationFeatures);

    For the first time, the code runs successfully. However, on the call to the AMImpl method even once, the ArrayDescriptor.createDescriptor get the following error:

    java.lang.ClassCastException: oracle.jdbc.proxy.oracle$ $1jdbc $1replay $1driver $1NonTxnReplayableBase $2oracle $1jdbc $1OracleTypeMetaData Array$ $$Proxy cannot be cast to oracle.sql.ArrayDescriptor

    I checked that the connection object is done correctly both times.

    I also tried to set the setting force = true in ArrayDescriptor.createDescriptor to replace any descriptor be cached.

    Pointers would be much appreciated.

    You must mention jdev version because there are changes in the ojdbc7 driver (jdev 12 c +).

    For example, this (old) approach with ArrayDescriptor.createDescriptor () is deprecated in favour of factory of conn.createOracleArray () or conn.createARRAY () methods.

    Also, how do you get 'st' object?

    Dario

  • Calling PL/SQL table...

    I have a procedure called from a package that returns all the data, the package uses a PL/SQL table that I do not know HOW to call or values that I would need to run the XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL (structure) with in the package, can someone tell me how it's done?

    Call package is downstairs, the record structure is less than the package call.

    DECLARE

    P_ITEM_NUMBER VARCHAR2 (200);

    DATE OF P_CURRENT_DATE;

    X_PWB_ORG_HIST_TBL APPS. XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL;

    BEGIN

    P_ITEM_NUMBER: = NULL;

    P_CURRENT_DATE: = NULL;

    -Modify the code to initialize the variable

    -X_PWB_ORG_HIST_TBL: = NULL;

    XXINV_PWB_HIST_FCST_PUB. () GET_ORG_DETAILS

    P_ITEM_NUMBER = > 91,

    P_CURRENT_DATE = > 2 February 2014 ",

    X_PWB_ORG_HIST_TBL = > X_PWB_ORG_HIST_TBL (which values should I put in the section)

    );

    Legacy release:

    DBMS_OUTPUT. PUT_LINE ('X_PWB_ORG_HIST_TBL =' |) X_PWB_ORG_HIST_TBL);

    -: X_PWB_ORG_HIST_TBL: = X_PWB_ORG_HIST_TBL;

    END;

    TYPE XXINV_PWB_Hist_Tbl IS TABLE OF THE XXINV_PWB_Hist_Rec

    INDEX OF DIRECTORY;

    TYPE XXINV_PWB_Org_Hist_Rec IS RECORD

    (

    Org_Hist_Index_Id NUMBER: = ".

    Item_Number Varchar2 (30): = ".

    Number of Quantity_1: = ".

    Number of Quantity_2: = ".

    Number of Quantity_3: = ".

    Number of Quantity_4: = ".

    Number of Quantity_5: = ".

    Number of Quantity_6: = ".

    Number of Quantity_7: = ".

    Number of Quantity_Total: = ".

    Date of Date_History: = ".

    Month_Year Varchar2 (15): = ".

    Number of Quantity_8: = ");

    Sorry I'm not familiar with PL/SQL tables...

    Thank you

    Help

    I can't go through your entire code. From there, you no need to use this plsql don't table as an input parameter because you do not pass anything... You're just fill with your values hard-coded... Then you can try the below stated

    DECLARE

    -declare the plsql table

    X_PWB_ORG_HIST_TBL APPS. XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL;

    BEGIN

    XXINV_PWB_HIST_FCST_PUB. GET_ORG_DETAILS (91, TO_DATE('02-FEB-2014','DD-MON-YYYY'), X_PWB_ORG_HIST_TBL);

    -The legacy output:

    BECAUSE me in X_PWB_ORG_HIST_TBL. FIRST... X_PWB_ORG_HIST_TBL. LAST

    LOOP

    -Add all columns to dbms_output print and test values

    DBMS_OUTPUT. PUT_LINE ('X_PWB_ORG_HIST_TBL =' |) X_PWB_ORG_HIST_TBL (i). Org_Hist_Index_Id | «, » || X_PWB_ORG_HIST_TBL (i). Item_Number);

    END LOOP;

    END;

  • How to assign values to the nested table and passes as a parameter for the procedure?

    How to assign values to the nested table and passes as a parameter for the procedure?

    Here are the object and its type

    create or replace type test_object1 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );


    create or replace type test_type1 is table of the test_object1;


    create or replace type test_object2 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );


    create or replace type test_type2 is table of the test_object2;


    GRANT ALL ON test_object1 to PUBLIC;


    GRANT ALL ON test_type1 to PUBLIC;


    GRANT ALL ON test_object2 to PUBLIC;


    GRANT ALL ON test_type2 to PUBLIC;

    Here is the table object type:

    create the table test_object_tpe
    (
    sl_num NUMBER,
    Description VARCHAR2 (100),
    main_val1 test_type1,
    main_val2 test_type2
    )


    NESTED TABLE main_val1 STORE AS tot1
    NESTED TABLE main_val2 STORE AS earlier2;


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

    Here is the procedure that inserts values into the nested table:

    PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
    Description in VARCHAR2,
    p_main_val1 IN test_type1,
    p_main_val2 IN test_type2
    )
    IS
    BEGIN

    FOR rec in p_main_val1.first... p_main_val1. Last
    LOOP

    INSERT INTO xxdl.test_object_tpe
    (
    sl_num,
    Description,
    main_val1,
    main_val2
    )
    VALUES
    (
    sl_num
    description
    test_type1 (test_object1)
    p_main_val1 .val1 (CRE),
    p_main_val1 .val2 (CRE),
    p_main_val1 .val3 (rec)
    )
    )
    test_type2 (test_object2 (p_main_val2 .val1 (CRE),
    p_main_val2 .val2 (CRE),
    p_main_val2 .val3 (rec)
    )
    )

    );

    END LOOP;

    commit;

    END INSERT_TEST_DATA;

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

    Here are the block anonymoys what values attributed to the object type and pass values in the procedure:

    Set serveroutput on;

    declare

    p_sl_num NUMBER: = 1001;
    p_description VARCHAR2 (50): = 'Test Val1;

    inval1 test_type1: = test_type1();
    inval2 test_type2: = test_type2();

    Start


    inval1 (1) .val1: = "testx1";
    inval1 (1) .val2: = "testx2";
    inval1 (1) .val3: = "testx3";

    inval2 (1) .val1: = "testy1";
    inval2 (1) .val2: = "testy2";
    inval2 (1) .val3: = "testy3";

    CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
    Description = > p_description,
    p_main_val1 = > inval1,
    p_main_val2 = > inval2
    );

    end;
    /
    Someone can correct me.

    Thank you
    Lavan

    Thanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
    >
    How to assign values to the nested table and passes as a parameter for the procedure?
    >
    Well you do almost everything bad that could be hurt.

    Here is the code that works to insert data into your table (the procedure is not even necessary).

    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1.extend();
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    inval2.extend();
    inval2(1) := test_object2('testy1', 'testy2', 'testy3');
    
    INSERT INTO test_object_tpe
    (
    sl_num,
    description,
    main_val1,
    main_val2
    )
    VALUES
    (p_sl_num, p_description, inval1, inval2);
    commit;
    end;
    /
    

    See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA

    1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)

    inval1(1).val1 := 'testx1';
    

    Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element

    inval1.extend();
    

    And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
    If you can not do

    inval1(1).val1 := 'testx1';
    

    You must create an instance of 'test_object1 '.

    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    

    And so on for the other collection

    You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.

  • PL/SQL tables

    Hello guys,.
    I have a few questions about the PL/SQL tables

    (1) if I don't specify the 'INDEX BY' clause, they are indexed by PLS_INTEGER default, right?

    (2) consider this package specification
    CREATE OR REPLACE PACKAGE Testxyz AS
    
    TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
    
    PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL);
    
    
    END Testxyz;
    So I created a table (I hope it's standard indexed by type of data pls_integer) and I am in him passing as parameter to a procedure. Because I want this parameter be optional I assign null inside.

    Now, I change the table definition for:
    CREATE OR REPLACE PACKAGE Testxyz AS
    
    TYPE tab_Numbers IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
    
    PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL);
    
    
    END Testxyz;
    Try to compile it and you get:
    Error (5.53): PLS-00382: expression is of the wrong type

    Why?

    (3) because I need this optional parameter, I use the first statement:
    CREATE OR REPLACE PACKAGE Testxyz AS
    
    TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
    
    PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL);
    
    
    END Testxyz;
    Now I create an anonymous block, and you want to set something in the table
    DECLARE
       vtab_Numbers TESTXYZ.tab_Numbers;
    BEGIN
    
       vtab_Numbers(1) := 5;
    
    
    END;
    /
    When you try to run it, I got:
    06531 00000 - 'refers to an uninitialized collection.

    Can someone help me understand this problem?
    Is it possible to have input of type PL/SQL table setting and have a standard null, are assigned?

    Thanks, Dan

    (1) if I don't specify the 'INDEX BY' clause, they are indexed by PLS_INTEGER default, right?

    N ° or somehow.

    More critical, and using official terms of [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#CHDBHJEI] documentation so that we don't get into unnecessary arguments about the correct terms for these features, it's the difference between types of ASSOCIATIVE TABLE and the IMBRIQUEE TABLE collection.

    If you omit the "INDEX BY" clause, it is a type of TABLE IMBRIQUEE collection. A type of TABLE IMBRIQUEE is always indexed by PLS_INTEGER.

    When you include the ' INDEX OF ', this is an ASSOCIATIVE ARRAY.

    (2) consider this package specification
    Try to compile it and you get:
    Error (5.53): PLS-00382: expression is of the wrong type

    Why?

    Because you cannot assign NULL to an ASSOCIATIVE ARRAY.

    In the same way, you cannot do this:

    SQL> DECLARE
      2   TYPE tab_Numbers IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
      3   v1 tab_Numbers;
      4  BEGIN
      5   v1 := NULL;
      6  END;
      7  /
     v1 := NULL;
           *
    ERROR at line 5:
    ORA-06550: line 5, column 8:
    PLS-00382: expression is of wrong type
    ORA-06550: line 5, column 2:
    PL/SQL: Statement ignored
    
    SQL> 
    

    If you want two entry points to TestNumber with an ASSOCIATIVE ARRAY or NULL then overload the procedure.

    If you want to call a procedure with a TABLE IMBRIQUE collection type you can the default empty:

    SQL> CREATE OR REPLACE PACKAGE Testxyz
      2  AS
      3   TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
      4   PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers DEFAULT tab_Numbers());
      5   PROCEDURE TestNumber;
      6  END Testxyz;
      7  /
    
    Package created.
    
    SQL> 
    

    (3) because I need this optional parameter, I use the first statement
    When you try to run it, I got:
    06531 00000 - 'refers to an uninitialized collection.

    Because you have not initialized it.

    Different collection types require different semantics.

    SQL> DECLARE
      2   TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
      3   v1 tab_Numbers;
      4  BEGIN
      5   v1(1) := 5;
      6  END;
      7  /
    DECLARE
    *
    ERROR at line 1:
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 5
    
    SQL> DECLARE
      2   TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
      3   v1 tab_Numbers := tab_Numbers();
      4  BEGIN
      5   v1(1) := 5;
      6  END;
      7  /
    DECLARE
    *
    ERROR at line 1:
    ORA-06533: Subscript beyond count
    ORA-06512: at line 5
    
    SQL> DECLARE
      2   TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
      3   v1 tab_Numbers := tab_Numbers();
      4  BEGIN
      5   v1.extend();
      6   v1(1) := 5;
      7  END;
      8  /
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • How can I write in a table cell (row, column appear) in a databae?

    How can I write in a table cell (row, column appear) in a database using LabVIEW Database Toolkit? I use Ms Access. Suppose I have three columns in a table, I write 1 row of the 1st column, then 1st rank of the 3rd column. The problem I have is after writing the 1st column of 1st row, the reference goes to the second row, and if I write in the 3rd column, he goes to the 2nd row 3rd column. Any suggestion?

    When you perform a SQL INSERT command, you create a new line. If you want to change an existing line, you must use the UPDATE command (i.e. UPDATE tablename SET column = value WHERE some_column = some_value). The some_column could be the unique ID of each line, date and time, etc.

    I don't know what is the function to use in the Toolbox to execute a SQL command, since I do not use the Toolbox. Also, I don't understand why you don't do a single INSERT. It would be much faster.

  • can the run/run .sql script in another application?

    Hello..

    I have a problem to run my .sql script (for example: @c:\Users\test.sql) in my netbeans application. There is no problem when I want to run/run my sql query (for example: "select * from...").

    But when I want to run my script, no presentation of the result. my script content my query to export to the csv file.

    script: @c:\Users\test.sql

    in the script:

    coil c:\Users\test.csv;

    ' Select ' ' ' | LOT_NUMBER | « «, » » || DEVICENUMBER | « «, » » || DEVICENAME | « «, » » || STEP_NAME | « «, » » || INSERT_DATE | « «, » » || STATUS | « «, » » || DISPOSEDBY | « «, » » || ACCEPTBY | « «, » » || AVAILABLE | « «, » » || GENDISPOSITION | » » »

    of RF_LOT_ON_HOLD_LIST;

    spool off;

    Thank you.

    bunch

    Yes, we know what talking about your question.

    a .sql script is just a plain text file containing everything you want.  The code in it can be a pure SQL statements, it may contain of the PL/SQL code, and it can also include SQL * more specific orders (keep in mind SQL * more is a tool, not a language, so that these commands are specific to this tool and other tools which can also interpret the same commands).

    Not quite sure how your question relates to this blog, as this blog is showing the code that gets the data in JSON format in a jqGrid (jQuery grid?) and then exports the data in an Excel file.

    What you're trying to do is to take a series of SQL * Plus and SQL statements in a text file and generate a CSV file from them.

    As already mentioned, SPOOL is a SQL * more order, specific to SQL * more command line tool.  The database itself has no idea what "spool" means, while passing to the database somehow does not work.  I also doubt that netbeans knows what that means, either.

    So, in short, how you try to do, not you cannot.

  • Element in the pl/sql table

    Hi all

    I have an array of integers that contains thousands of values such as 100,200,300,400,5000.

    Now, I want to know whether the table contains the value of 377. What should be my corner.

    There is doesn't work here because it only works with the item number. Here, I have only the content.

    Concerning

    Rajat

    Types can be defined in SQL and PL/SQL. The collections based on the SQL types can be used in SQL statements.

    set serveroutput on
    declare
      lt_nums sys.odcinumberlist := sys.odcinumberlist(1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99);
      l_result number;
    begin
      select count(*) into l_result
      from table(lt_nums)
      where column_value = 55;
      dbms_output.put_line('Number of found occurences = ' || l_result);
    end;
    /
    

    anonymous block filled

    Number of found rows = 1

    Post edited by: Ashton stew - I see RP says the same thing (and more) while I was typing my response. Well...

  • How to execute a SQL statement that is stored within a SQL Table

    Hello

    If someone please help me with the following problem I would be eternally grateful

    I have a SQL statement that is stored inside a certain SQL table, I want to use this SQL statement inside my PL/SQL procedure.

    Thought a simple solution was to get the SQL statement in a table, and then run it, but how could I do so exactly with PL/SQL? I only started to play with PL/SQL in the last days.

    Thanks in advance!

    This is what it looks like more or less:

    Display result for:

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

    SELECT TRIM (OBJ_VALU_TXT)

    OF OBJ_VALU_DOC

    WHERE TYPE_OBJET = 'FLD '.

    AND OBJECT_CODE = 15443

    AND OBJ_VALU_CD = 'CAB '.

    ORDER BYDOC_SEQ_NO

    00001

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

    SELECT

    VALUE (MAX (RECEIPT_NO) + 1,: OUT-COMP-FACTOR)

    THE FRONT DESK

    WHERE (RECEIPT_NO BETWEEN

    (: OUT-COMP-FACTOR AND: OUT TO A NUMBER) OR

    (RECEIPT_NO >: OUT-COMP-FACTOR AND)

    (: OUT-TO-NUMBER = 0)

    Here's a demo of your condition.

    create table t (col1 varchar2 (200));

    table created

    insert into values t ('select * from double ');

    1 row inserted

    declare
    v_col varchar2 (200);
    v_val varchar2 (200);
    Start

    Select col1 in t v_col;

    run immediately v_col in v_val;
    dbms_output.put_line (v_val);
    end;

    -----
    X

    Use in the clause, you can use as many variables as needed. But the basic approach remains the same.

    But storage in DB SQL is not an efficient design.

    Ishan

  • SOA calling a MS SQL table to insert data.

    Hello
    I configured a XA driver to insert data into the MS SQL Server table. When I execute the stream with a SOAP user interface. I was able to insert the data from MS SQL table. But in the end, the transaction is rolled back.


    I would ask you
    < soapenv:Envelope xmlns:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns:mvn = "http://xmlns.oracle.com/MVNEIDM/MVNESelfRegistration/MVNESelfRegistration" >
    < soapenv:Header / >
    < soapenv:Body >
    < mvn:MVNESelfRegistrationRequest >
    < mvn:subscriberId > 12345 < / mvn:subscriberId >
    < mvn:Keyword > 456 < / mvn:Keyword >
    < mvn:completionDt > 2013-02-06 T 16: 24:06.952 < / mvn:completionDt >
    < mvn:expirationdt > 2013-02-06 T 16: 24:06.952 < / mvn:expirationdt >
    < / mvn:MVNESelfRegistrationRequest >
    < / soapenv:Body >
    < / soapenv:Envelope >


    Erros on SOAP UI are:

    < env:Envelope = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:env >
    < env:Header / >
    < env:Body >
    < env:Fault >
    env:Server < faultcode > < / faultcode >
    incorrect object name < faultstring > [FMWGEN] [SQLServer JDBC Driver] [SQL Server] ' dbo. SelfRegistration'. < / faultstring >
    < faultactor / >
    < detail >
    < exception / >
    < / details >
    < / env:Fault >
    < / env:Body >
    < / env:Envelope >

    The managed server log the error is


    Form weblogic server: -.
    Error committing transaction:; nested exception is: Exception [EclipseLink-4002] (Eclipse - 2.1.3.v20110304 persistence Services - r9073): org.eclipse.persistence.exceptions.DatabaseException internal Exception: weblogic.jdbc.sqlserverbase.ddc: invalid object name [FMWGEN] [SQLServer JDBC Driver] [SQL Server] ' dbo. SelfRegistration'. Error code: 208


    The process ends with an error, but why he is rolling abck the transaction at the end. The table of the object was existing in the database and I traced the table to insert the data from the input variable reception to invoke the input variable. BPEL Instance he executed until the end, but in the end, the transaction is rolled back.

    Thank you
    Newcomer Raja

    Invalid object name ' dbo. SelfRegistration'

    I'm assuming you can see a SelfRegistration table in your database... So, I guess that BOD is not the name of the diagram on the right...

  • Is it possible to use the record type or a PL/SQL table in the Select statement

    Hi all

    My requirement is that.
    I want to write a query and write a function, function, I want to return multiple columns at the same time in a Select statement.
    I select the return values in the Select no statement in a PL/SQL block.
    Is it possible to use the PL/SQL Table or Variable of Type record, or any other method in the statement Select?

    Please help me understand the solution.


    Kind regards

    830960 wrote:
    do we like it?

    In general, Yes, if the function is a function table, you can do something like:

    select  t.col1,
            t.col2,
            f.col1,
            f.col2,
            f.col3
      from  table_name t,
               table(some_table_function(param1,...paramN)) f
    /
    

    SY.

  • Seat Distribution-Can, we do in SQL?

    Hello

    11 GR 2 DB

    Here is the table structure and data (data and the Test tables)
    create table seat_master(grade varchar2(1),balance number);
    
    insert into seat_master values('A',3);
    insert into seat_master values('B',2);
    insert into seat_master values('C',1);
    insert into seat_master values('D',1);
    insert into seat_master values('E',6);
    
    create table seat_reservation(res_id varchar2(5),grade varchar2(1),
                res_count number,group_flag varchar2(1));
    
    insert into seat_reservation values('R1','A',2,'Y');
    insert into seat_reservation values('R2','B',1,'Y');
    insert into seat_reservation values('R3','A',2,'Y');
    insert into seat_reservation values('R4','C',2,'N');
    insert into seat_reservation values('R5','E',3,'N');
    insert into seat_reservation values('R6','D',2,'N');
    
    select *
    from seat_master;
    
    GRADE BALANCE
    ----- -------
    A           3 
    B           2 
    C           1 
    D           1 
    E           6 
    
    
    select *
    from seat_reservation;
    
    RES_ID GRADE RES_COUNT GROUP_FLAG
    ------ ----- --------- ----------
    R1     A             2 Y          
    R2     B             1 Y          
    R3     A             2 Y          
    R4     C             2 N          
    R5     E             3 N          
    R6     D             2 N          
    
     6 rows selected  
    Now, the goal is to distribute the seats according to the booking.

    Rules:
    Distribution of seats is done according to the order of the (ORDER OF RES_ID) RES_ID
    A is the highest grade and E is the lowest.
    For one person booked for A, and if the balance is not available for him will be given B (and C, D, E).
    A person reserved for B, and if the balance is not available for him will be given C (then D, E), but optical quality will not be given
    GROUP_FLAG means that the reserve must be in the same category-
    For example, R1, is for 2 seats in the a. They won't 1 seat and 1 seat in B.Both the two seats should be in A or B or C...
    And for a booking, seats should be allocated that if the total number of requestd is if requested available.ie count is 2 and is only available in the particular category or below it cannot be awarded

    The expected results are:
    RES_ID SEAT 
    ------ ----
    R1          A1 
    R1          A2--Two A grade seats for R1, as R1 has RES_COUNT-2
           
    R2     B1
    
    R3          E1--R3 is given E grade, bcause as per now 2 seats 
    R3          E2--are not available in A or B or C.And GroupFlag is Y for him
    
    R4          C1--Only one seat availabl in C grade, so next seat will be Given
    R4          D1--in lower available grade
    
    R5          E3
    R5          E4
    R5          E5
    R6            --Blank as only one seat can be awarded
    Currently, this is done in PL/SQL, we can do it in SQL?

    Thank you.

    Published by: 884476 on November 18, 2012 12:14 AM

    Hello

    As I said before the query can be optimized.

    I also solved a problem for the group_flag = ' don't
    He showed plenty of seats assigned in case there are too many availlable.

    See the result below:

    WITH BAL AS
    --ADD A '0' SEAT TO THE LIST OF SEATS
      (select * from seat_master UNION ALL
      SELECT '0', 0 FROM DUAL
      )
    ,MOD_IN AS
      (
      SELECT
        SR.RES_ID
        ,RANK() OVER (PARTITION BY BAL.GRADE ORDER BY SR.RES_ID) RES_NO
        ,BAL.GRADE
        ,BAL.BALANCE
        ,SR.GRADE    RES_GRADE
        ,CASE WHEN BAL.GRADE = '0' THEN SR.RES_COUNT ELSE 0 END RES_COUNT
        ,SR.GROUP_FLAG
      FROM
        SEAT_RESERVATION SR
        ,BAL
      )
    ,MDL AS
      (
      SELECT
        *
      FROM
        MOD_IN
      MODEL
      DIMENSION BY (RES_NO, GRADE)
      MEASURES ( RES_ID, BALANCE,RES_GRADE, RES_COUNT, GROUP_FLAG GF)
      RULES
      SEQUENTIAL ORDER
      ITERATE(10) UNTIL (RES_ID[ITERATION_NUMBER + 1,0] IS NULL)
        (
        --DISTRIBUTE SEATS PER REQUEST
        RES_COUNT[ITERATION_NUMBER + 1, FOR GRADE in (select grade FROM BAL WHERE GRADE > '0' ORDER BY GRADE )] =
                CASE WHEN GF[CV(),CV()] = 'Y'
                          AND MAX(RES_COUNT) [CV(), GRADE > '0'] = 0
                          AND BALANCE[CV(), CV()] >= RES_COUNT[CV(),0]
                          AND RES_GRADE[CV(), CV()] <= CV(GRADE)
                     THEN RES_COUNT[CV(),0] 
    
                          WHEN GF[CV(),CV()] = 'N'
                          AND SUM(RES_COUNT) [CV(), GRADE > '0'] < RES_COUNT[ITERATION_NUMBER + 1,0]
                          AND SUM(BALANCE) [CV(), GRADE >= RES_GRADE[CV(),CV()] ] >= RES_COUNT[CV(),0]
                          AND RES_GRADE[CV(), CV()] <= CV(GRADE)
                     THEN LEAST(2 * RES_COUNT[CV(),0] - SUM(RES_COUNT) [CV(), GRADE < CV(GRADE)], BALANCE[CV(), CV()] )
                     ELSE 0 END
    
        --UPDATE CURRENT BALLANCE
        ,BALANCE[ITERATION_NUMBER + 1, ANY] = BALANCE[CV(), CV()] - RES_COUNT[CV(),CV()]
        --UPDATE NEXT BALANCE
        ,BALANCE[ITERATION_NUMBER + 2, ANY] = BALANCE[ITERATION_NUMBER + 1, CV()]
        )
      )
    
    SELECT
      MDL.RES_ID
      ,MDL.GRADE || COUNT(1) OVER (PARTITION BY MDL.GRADE ORDER BY MDL.RES_ID, SC.LVL) SEAT
    FROM
      MDL
      ,(SELECT LEVEL LVL FROM DUAL CONNECT BY LEVEL < 100)  SC
    
    WHERE
      MDL.RES_COUNT       > 0
      AND MDL.GRADE       > '0'
      AND SC.LVL          <= MDL.RES_COUNT
    
    ORDER BY
      1,2
    ;
    
    RES_ID SEAT
    ------ -----------------------------------------
    R1     A1
    R1     A2
    R2     B1
    R3     E1
    R3     E2
    R4     C1
    R4     D1
    R5     E3
    R5     E4
    R5     E5                                        
    
     10 rows selected 
    

    Kind regards

    Peter

    Published by: Peter vd Zwan on 27 November 2012 13:35
    Changed the end result to match output OP

Maybe you are looking for

  • Decommissioning account iCloud

    How can we stop all payments to iCloud?  All Apple "Support" pages are a joke because they only sent around in circles referring to the page that I just read.    Thank you.

  • Satellite C70-A-13D: cannot create recovery media - error 02016e-3 c-0000000

    Hello I am creating a recovery flash drive on my new laptop satellite c70-a-13d windows 8 operating system and get the following message differences between the files following z\recovery\install20.swm target path e:\\zzimages\zzimages\install20.swm

  • Is there a line in jack on HP Touchsmart 310 - 1124f, windows 7?

    I would like to do some recording using a source in 'line '. Most PCs have a blue female jack 1/8 inch. I don't see one. The entry-level job mic for all record sources?

  • Map of graphics update in a GB specifications

    I would like to install an updated video card my laptop NVIDIA GT720M, I am in contact NVIDIA who referred me to HP the manufacturer of the laptop, I rang them and they don't give me advice at all (some customer service) can each there say if I put a

  • Computer blocks each mode 'sleep' last days 6

    Whenever my computer goes into sleep mode, it hangs and I have to turn off the power strip and restart completely. After that, everything is completely normal-internet, etc. I am also able to download the latest update for Windows XP service pack 4.