Pass the name of the table as parameter PLS-00357

create or replace
PROCEDURE universal_p)
tab in VARCHAR2,
Col in VARCHAR2,
WHR IN VARCHAR2: = NULL)
IS
TYPE cv_type IS REF CURSOR;
CV cv_type;
Val VARCHAR2 (32767).
BEGIN
OPEN FOR CV
"SELECT" | Col |
'FROM ' | tab |
'WHERE ' | NVL (w/h, '1 = 1');

LOOP
CV FETCH IN val;
WHEN the OUTPUT cv % NOTFOUND;
IF ROWCOUNT = 1 CV(%)
THEN
DBMS_OUTPUT. PUT_LINE (RPAD ('-', 60, '-'));
DBMS_OUTPUT. PUT_LINE)
"The contents of" |
SUPERIOR (tab) | '.' || En_HAUT (col));
DBMS_OUTPUT. PUT_LINE (RPAD ('-', 60, '-'));
END IF;
DBMS_OUTPUT. Put_line (val);
END LOOP;

CLOSE cv;
END;
*********************************
WHEN I CALL THIS PROCEDURE I might see error

ORA-06550: Table, view or sequence of reference not allowed in this context.
PLS-00357:

Can someone can help me, please?
WHEN

Published by: user6446424 on 11.3.2010 13:59

Works for me:

SQL> create or replace
  2  PROCEDURE universal_p (
  3  tab IN VARCHAR2,
  4  col IN VARCHAR2,
  5  whr IN VARCHAR2 := NULL)
  6  IS
  7  TYPE cv_type IS REF CURSOR;
  8  cv cv_type;
  9  val VARCHAR2(32767);
 10  BEGIN
 11  OPEN cv FOR
 12  'SELECT ' || col ||
 13  ' FROM ' || tab ||
 14  ' WHERE ' || NVL (whr, '1 = 1');
 15
 16  LOOP
 17  FETCH cv INTO val;
 18  EXIT WHEN cv%NOTFOUND;
 19  IF cv%ROWCOUNT = 1
 20  THEN
 21  DBMS_OUTPUT.PUT_LINE (RPAD ('-', 60, '-'));
 22  DBMS_OUTPUT.PUT_LINE (
 23  'Contents of ' ||
 24  UPPER (tab) || '.' || UPPER (col));
 25  DBMS_OUTPUT.PUT_LINE (RPAD ('-', 60, '-'));
 26  END IF;
 27  DBMS_OUTPUT.PUT_LINE (val);
 28  END LOOP;
 29
 30
 31  CLOSE cv;
 32  END;
 33
 34  /

Procedure created.

SQL> exec universal_p('EMP','ENAME')
------------------------------------------------------------
Contents of EMP.ENAME
------------------------------------------------------------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER

PL/SQL procedure successfully completed.

SQL> select * from v$version
  2  ;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE    11.1.0.6.0      Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production

Max
http://oracleitalia.WordPress.com

Tags: Database

Similar Questions

  • Name of the table as parameter of function

    Hi all

    can someone help me with the below question...

    I have a function like this:

    * create or replace *.
    * the 'IL_SUM_AVG_FN' function return number is *.

    * the cursor c1 is *.
    * Select sum_avg_val value *.
    * from wel_10_tab *.
    * where type = '1'; **
    * number of v_sum; **
    * number of v_count; **
    * BEGIN *.
    * v_sum: = 0; **
    * v_count: = 0; **
    * for i looped c1 *.
    * if v_count = 0 then *.
    * v_sum: = i.value; *
    * other *.
    * v_sum: = abs (i.value + v_sum); **
    * end if; **
    * v_count: = v_count + 1; **
    * end of loop; **
    * return v_sum; **
    * END; **


    now my requirement is like... I want to pass a value as a parameter to the function... say I'll or11 10 or 12
    then he should change the table name in the cursor according to the parameter.i.e
    If the setting is 10, it should be: select sum_avg_val value in wel_10_tab where type = '1';
    If the setting is 11 it should be: select sum_avg_val value in wel_11_tab where type = '1';
    If the parameter is 12, you must: select sum_avg_val value in wel_12_tab where type = '1';

    parameter only has these three possible values...
    How to get there?
    Help, please...

    Sybrand already showed you how to manage the setting if you look at its code.

    You need the dynamic sql statements because you can't pass the names of tables in pl/sql standard.
    His example has dynamic sql.

    So now you must only adapt to your needs.

    Default you may have a separate slider for each table name and choose the cursor based on the name of the table that is passed.

    Those are your only 2 realistic options at this stage.

  • not able to pass the table name as parameter in the function

    Hello

    I am not able to move from tablename as parameter. I use the below function.
    -------------------------------------------------------------------------------------------------

    function count_test (tabname varchar2) return number is
    l_count number;
    Start

    Select count (*) IN the tabname FROM l_count;

    RETURN l_count;
    END;

    You can not do with static SQL.

    The only way is to do it with dynamic SQL:

    EXECUTE IMMEDIATE ' select count (*) FROM ' | tabname INTO l_count;

    Kind regards.
    Al

    Published by: Alberto Faenza 10 may 2012 01:44
    Misspelling

  • Droping a table from within a procedure by passing the name of the Table as an Argument

    HII All

    I want to remove a table from a procedure dynamically passing the table name as a parameter of a procedure manual

    to do this, I wrote the following procedure

    CREATE OR REPLACE PROCEDURE DEL_TAB (TAB_NAME IN VARCHAR2) AS

    V_TAB_NAME VARCHAR2 (10);

    V_STMT VARCHAR2 (50);

    BEGIN

    V_TAB_NAME: = TABLE_NAME;

    V_STMT: = 'DROP TABLE' | V_TAB_NAME;

    RUN IMMEDIATELY 'V_STMT ';

    DBMS_OUTPUT. PUT_LINE(V_TAB_NAME||) e TABLE DELETED ');

    END DEL_TAB;

    but whenever I'm execute it gives me an error

    ERROR on line 1:

    ORA-06550: line 1, column 15:

    PLS-00357: Table, view or sequence of reference 'A' not allowed in this context

    ORA-06550: line 1, column 7:

    PL/SQL: Statement ignored

    Please tell me the solution...

    Thanks in advance

    Alisson

    Why do you want to implement this procedure? If you want to remove a table just issue the DROP of stand-alone statement. Why write a procedure for this? Also you must understand the difference between REMOVE and DROP in the context of RDBMS. You either use them which is incorrect. DELETION is to remove rows from a table and DROP is to remove the database table.

    And with regard to your problem

    > RUN IMMEDIATELY 'V_STMT ';

    This should be

    immediately run v_stmt;

    You closed the V_STMT variable is in single quotes. You must remove the apostrophes.

  • How to pass a single form filed with the second shape parameter

    Hi all,
    I get the custom form a requirment.already one, just added the button when the button on a new form opens, this form with a logical filed.here is the first form a single block dat filed pass the second shape parameter


    Kind regards
    Sandrine

    994418 wrote:
    Hi, HAMID

    Hi stephane
    Good here we solve you your problems. If you share the solution other people can get the same kind of help from you.

    Also when you check the option add any thread as a response, if it solved * [SOLVED] * to the left of your subject line.

    Hamid

    Mark correct/good to help others to get the right answers. *

  • disorder affecting the values in the table according to cfscript

    I try to pass an array to a function, cfscript and assigning values to it. When I see if the value has been assigned to the right, I get an error saying I'm trying to dereference a scalar.

    function g (q, recsq, arr) / / q is a query name, recsq is the number of lines in q, arr is an array name

    {

    evaluate (arr &'[1] [1] ='& q &'.code [1]');
    WriteOutput(a[1][1]);
    }
    g('qpr','#recsqpr#','apr');

    The allocation already works if I don't mean to call a function, but I would like to know what I'm doing wrong.

    This "disorder" have you passing the table in?

    There is no difference in passing an array as a parameter of function in any other kind of data type:

    myArray = arrayNew();
    myArray [1] = 'something ';
    myArray [2] = "something";

    myArray = myFunction (myArray);

    writeOutput ("here is the new value: #myArray [3] #");

    Function myFunction (someArray) {}
    arrayAppend (someArray, 'new value');
       
    return untableau;
    }

    Do you understand how everything works?

    --

    Adam

  • How to give the table name as input for the insertion procedure parameter

    Hello
    Could a little help in this scenario,
    Here is an example of how to insert,
    where the 'b' table name will change at each
    is there a possible way to keep the name of the table as an input parameter

    SQL > CREATE or REPLACE PROCEDURE PROC_INSERT as
    BEGIN 2
    3 INSERT INTO A
    4 (ID, NAME, LOC)
    5. SELECT ID, NAME, B LOC;
    6 VALIDATION;
    7 END;

    Kind regards
    Vikram

    If you need to pass the object name to a SQL running, you must use dynamic SQL statements.

    A simpler way is the following

    create or replace procedure proc_insert
    (
         pTableName varchar2
    )
    as
    begin
         execute immediate 'insert into a (id, name, loc) select id, name, loc from ' || pTableName;
         commit;
    end;
    
  • How to pass the parameter of column in a table of trinidad to the next page?

    Hello
    In fact, we work with trinidad tables and forms on our pages snce we will deploy to mobile.
    I saw a video shared by Shay, parameter passing between pages with adf components - the column was converted to create a link, then it a setProperty earphone is placed on the table to catch the parameter.
    How can do us same with paintings of the Trinity? I do not see any place to convert the column link, but in vain.
    I tried to use a radio button select with the table, but I do not know how to extract the value of this.
    Please provide your valuable suggestions on this.

    Concerning

    Hello

    If you go to the source of table view you see something like

    TR:column containing--> tr:outputText

    You would simply change the tr:outputText to tr:commandLink

    Frank

  • How to pass the name of the Table as an argument in Stored Proc

    Hello
    I have a condition in which the name of the table must be passed as an argument of MS and the output should be the County of this table based on certain conditions to filter.

    Something like this:

    create or replace procedure Testing (p_table varchar2, p_count OUT integer) AS
    Start
    Select count (1) in the p_count of p_table;
    end;
    /

    Get the error on execution of code above:
    PL/SQL: ORA-00942: table or view does not exist

    Please let me how can know we do this?

    Thank you.

    Just add the where clause in the statement...

    What about spending ten minutes of reading literature?

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2009/12/31/estrarre-i-dati-in-formato-xml-seconda-parte/]

  • problem with writing a procedure with the name of the table as an input parameter

    Hi all

    I am writing a procedure with the table name as input parameter:
    Here is the code

    create or replace procedure CEP (in_tbl in varchar2)
    as
    Start

    run immediately 'truncate table tlb;

    Insert into tbl

    Select a, b, c of in_tbl;

    end;

    user579585 wrote:
    Hi all

    I am writing a procedure with the table name as input parameter:
    Here is the code

    create or replace procedure CEP (in_tbl in varchar2)
    as
    Start

    run immediately 'truncate table tlb;

    Insert into tbl

    Select a, b, c of in_tbl;

    end;

    You will also need to use dynamic sql for insert statements:

    execute immediate 'begin insert into tbl select a,b,c from '||in_tbl||'; end';
    
  • How to pass the Visa Resource Name parameter to labview dll in labwindows/cvi

    Hello world

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

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

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

    BRs,

    lotusky

    Hey, guys:

    I figured out how to pass the parameter.

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

    I hope this will help others!

    lotusky

  • How to pass the content of the table as OUT of the stored procedure parameter

    Hi all

    I am writing a stored procedure where he must accept date as one of the parameters IN and it must interrogate the table of database on this criterion and should address data in a temporary table.

    in the end, he must send all the data from the temporary table as the OUT parameter.

    How to get there? should I create a new TYPE with all the columns in the Temp table and use this Type as a parameter? or SYS_REFCURSOR is the best option.

    Thanks in advance.

    Hello

    The best way to do what you want depends on what you want.  Start by describing what you need to do.  It is best to post some data examples (CREATE TABLE and INSERT statements), and what results you want from this sample data.  (See the FAQ forum: https://forums.oracle.com/message/9362002)

    If you have any ideas on how to do the work (for example, populating a temporary table) it may be useful to include those who, too, but a clear distinction between WHAT you do and HOW you do it.

    Bencol suggested, a SYS_REFCURSOR may be the best way to transmit the results.

    Since you only post your table, or even describe what you wanted to do with it, I will illustrate using scott.emp, which is probably on your system.

    Say you want a procedure that takes a DATE as an argument, then returned a certain designated columns (empno, ename, and hiredate in the example below) for all employees hired from the given DATE.  You can write a procedure like this:

    CREATE OR REPLACE PROCEDURE hired_since

    (IN start_date DATE

    out_data ON SYS_REFCURSOR

    )

    AS

    BEGIN

    OPEN FOR Out_data

    SELECT ename, empno, hiredate

    FROM scott.emp

    WHERE hiredate > = start_date;

    END hired_since;

    /

    DISPLAY ERRORS

    You can test it in SQL * more like this:

    VARIABLE c REFCURSOR

    EXEC hired_since (DATE ' 1982-01-01',: c);

    PRINTING: c

    The output I received this test was:

    ENAME, EMPNO, HIREDATE

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

    7788 SCOTT APRIL 19, 87

    7876 ADAMS MAY 23, 87

    7934 MILLER JANUARY 23, 82

  • In passing the huge parameter to oracle procedure have a performance hit?

    I have a script attached, in which I am trying process/XML parsing in a table (STAGE_TBL) in the XMLTYPE column and insert the data analyzed in another table (PROCESSED_DATA_TBL). The XML file can be huge up to 2MB, which translates into approximately 2000 + lines of analyzed data. The issue I see is when I pass an XML object to a procedure (STAGE_TBL_PROCESS) to analyze its takes about 10 seconds per XML, but rather than from XML if I directly pick up table in the procedure (STAGE_TBL_PROCESS) passing the ID to be about 0.15 seconds. According to the document while params are passed by reference, so why is this variation of performance?

    Details of database Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64-bit version of PL/SQL Production 11.2.0.3.0 - Production "CORE 11.2.0.3.0 Production" TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production

    Note: I could not perform SQL_TRACE or DBMS_STATS as I don't have access to them.

    /*
    This one is taking .15 seconds to process an XML with about 2000 rp_sendRow elements
    */

    DECLARE
     
    CURSOR NewStage IS
      
    SELECT *
      
    FROM STAGE_TBL
      
    WHERE  status = 'N'
      
    ORDER BY PUT_TIME ASC;
      SUBTYPE rt_NewStage
    IS NewStage % rowtype;

      ROW_COUNT INTEGER
    := 0;   -- Return value from calling the procedure
      READ_COUNT INTEGER
    := 0;   -- Number of rows read from the stage table
      INSERT_COUNT_TOTAL INTEGER
    := 0;   -- Number of Inserts Inven records
      ERROR_COUNT INTEGER
    := 0;   -- Number of Inven inserts that did inserted more then 1 row in Inven
      PROCESS_STATUS STATUS
    .MmsStatus;
      STATUS_DESCRIPTION STATUS
    .MmsStatusReason;
      ERRMSG VARCHAR2
    (500);

    PROCEDURE STAGE_TBL_PROCESS (IDDATA IN RAW, PROCESS_STATUS OUT VARCHAR2, STATUS_DESCRIPTION OUT VARCHAR2, ROW_COUNT OUT NUMBER) AS
    /*
      This procedure is to parse the XML from STAGE_TBL and populate the data from XML to PROCESSED_DATA_TBL table

      IN PARAMS
      ----------
      IDDATA - ID from STAGE_TBL
      xData - XMLType field from XML_DOCUMENT of STAGE_TBL

      OUT PARAMS
      -----------
      PROCESS_STATUS - The STATUS of parsing and populating PROCESSED_DATA_TBL
      STATUS_DESCRIPTION - The description of the STATUS of parsing and populating PROCESSED_DATA_TBL
      ROW_COUNT - Number of rows inserted into PROCESSED_DATA_TBL
    */

    BEGIN
      
    INSERT ALL INTO PROCESSED_DATA_TBL 
      
    (PD_ID, 
      STORE
    , 
      SALES_NBR
    , 
      UNIT_COST
    , 
      ST_FLAG
    , 
      ST_DATE
    , 
      ST
    , 
      START_QTY
    , 
      START_VALUE
    , 
      START_ON_ORDER
    , 
      HAND
    , 
      ORDERED
    , 
      COMMITED
    , 
      SALES
    , 
      RECEIVE
    , 
      VALUED
    , 
      ID_1
    , 
      ID_2
    , 
      ID_3
    , 
      UNIT_PRICE
    , 
      EFFECTIVE_DATE
    , 
      STATUS
    , 
      STATUS_DATE
    , 
      STATUS_REASON
    ) 
      
    VALUES (IDDATA 
      
    ,store 
      
    ,SalesNo 
      
    ,UnitCost 
      
    ,StWac 
      
    ,StDt 
      
    ,St 
      
    ,StartQty 
      
    ,StartValue 
      
    ,StartOnOrder 
      
    ,Hand 
      
    ,Ordered 
      
    ,COMMITED 
      
    ,Sales 
      
    ,Rec 
      
    ,Valued 
      
    ,Id1 
      
    ,Id2 
      
    ,Id3 
      
    ,UnitPrice 
      
    ,to_Date(EffectiveDate||' '||EffectiveTime, 'YYYY-MM-DD HH24:MI:SS') 
      
    ,'N'  
      
    ,SYSDATE 
      
    ,'XML PROCESS INSERT')  
      
    WITH T AS
      
    ( SELECT STG.XML_DOCUMENT FROM STAGE_TBL STG WHERE STG.ID = IDDATA)  
    -- This is to parse and fetch the data from XML 
      
    SELECT E.* FROM T, XMLTABLE('rp_send/rp_sendRow' PASSING T.XML_DOCUMENT COLUMNS
      store VARCHAR
    (20) PATH 'store'  
      
    ,SalesNo VARCHAR(20) PATH 'sales' 
      
    ,UnitCost NUMBER PATH 'cost' 
      
    ,StWac VARCHAR(20) PATH 'flag' 
      
    ,StDt DATE PATH 'st-dt' 
      
    ,St NUMBER PATH 'st' 
      
    ,StartQty NUMBER PATH 'qty' 
      
    ,StartValue NUMBER PATH 'value' 
      
    ,StartOnOrder NUMBER PATH 'start-on-order' 
      
    ,Hand NUMBER PATH 'hand' 
      
    ,Ordered NUMBER PATH 'order' 
      
    ,Commited NUMBER PATH 'commit' 
      
    ,Sales NUMBER PATH 'sales' 
      
    ,Rec NUMBER PATH 'rec' 
      
    ,Valued NUMBER PATH 'val' 
      
    ,Id1 VARCHAR(30) PATH 'id-1' 
      
    ,Id2 VARCHAR(30) PATH 'id-2' 
      
    ,Id3 VARCHAR(30) PATH 'id-3' 
      
    ,UnitPrice NUMBER PATH 'unit-pr' 
      
    ,EffectiveDate VARCHAR(30) PATH 'eff-dt' 
      
    ,EffectiveTime VARCHAR(30) PATH 'eff-tm' 
      
    ) E;  
      ROW_COUNT 
    := SQL%ROWCOUNT;  -- Not the # of all the rows inserted.
      PROCESS_STATUS 
    := STATUS.PROCESSED;
      
    IF ROW_COUNT < 1 THEN   -- The insert failed Row Count = 0 No exception thrown
      PROCESS_STATUS 
    := STATUS.ERROR;
      STATUS_DESCRIPTION 
    := 'ERROR Did not insert into Pos Inventory. Reason Unknown';
      
    END IF;
      EXCEPTION
      
    WHEN OTHERS THEN
      ROW_COUNT 
    := 0;
      PROCESS_STATUS 
    := STATUS.ERROR;
      STATUS_DESCRIPTION 
    := 'SqlCode:' || SQLCODE || ' SqlErrMsg:' || SQLERRM;
    END;


    BEGIN
      DBMS_OUTPUT
    .enable(NULL);
     
    FOR A_NewStage IN NewStage
      LOOP
      READ_COUNT
    := READ_COUNT + 1;
      STAGE_TBL_PROCESS
    (A_NewStage.ID, PROCESS_STATUS, STATUS_DESCRIPTION, ROW_COUNT);
      INSERT_COUNT_TOTAL
    := INSERT_COUNT_TOTAL + ROW_COUNT;
      
    IF(ROW_COUNT <= 0 OR PROCESS_STATUS = STATUS.ERROR) THEN
      ERROR_COUNT
    := ERROR_COUNT + 1;
      
    UPDATE STAGE_TBL
      
    SET status  = PROCESS_STATUS,
      status_DATE 
    = SYSDATE,
      status_DESCRIPTION 
    = STATUS_DESCRIPTION
      
    WHERE ID  = A_NewStage.ID;
      
    ELSE
      
    UPDATE STAGE_TBL
      
    SET status  = PROCESS_STATUS,
      status_DATE 
    = SYSDATE,
      status_DESCRIPTION 
    = STATUS_DESCRIPTION,
      SHRED_DT 
    = SYSDATE
      
    WHERE ID  = A_NewStage.ID;
      
    END IF;
      
    COMMIT;
     
    END LOOP;
     
    COMMIT;
     
    IF ERROR_COUNT > 0 THEN
      ERRMSG
    := '** ERROR: ' || ERROR_COUNT || ' Stage records did not insert in to the Processed table correctly';
      RAISE_APPLICATION_ERROR
    (-20001,ErrMsg); 
     
    END IF;
      EXCEPTION
      
    WHEN OTHERS THEN
      RAISE
    ;
    END ;

    /*
    This one is taking 10 seconds to process an XML with about 2000 rp_sendRow elements
    */

    DECLARE
     
    CURSOR NewStage IS
      
    SELECT *
      
    FROM STAGE_TBL
      
    WHERE  status = 'N'
      
    ORDER BY PUT_TIME ASC;
      SUBTYPE rt_NewStage
    IS NewStage % rowtype;

      ROW_COUNT INTEGER
    := 0;   -- Return value from calling the procedure
      READ_COUNT INTEGER
    := 0;   -- Number of rows read from the stage table
      INSERT_COUNT_TOTAL INTEGER
    := 0;   -- Number of Inserts Inven records
      ERROR_COUNT INTEGER
    := 0;   -- Number of Inven inserts that did inserted more then 1 row in Inven
      PROCESS_STATUS STATUS
    .MmsStatus;
      STATUS_DESCRIPTION STATUS
    .MmsStatusReason;
      ERRMSG VARCHAR2
    (500);

    PROCEDURE STAGE_TBL_PROCESS (IDDATA IN RAW, xData IN STAGE_TBL.XML_DOCUMENT%TYPE, PROCESS_STATUS OUT VARCHAR2, STATUS_DESCRIPTION OUT VARCHAR2, ROW_COUNT OUT NUMBER) AS
    /*
      This procedure is to parse the XML from STAGE_TBL and populate the data from XML to PROCESSED_DATA_TBL table

      IN PARAMS
      ----------
      IDDATA - ID from STAGE_TBL
      xData - XMLType field from XML_DOCUMENT of STAGE_TBL

      OUT PARAMS
      -----------
      PROCESS_STATUS - The STATUS of parsing and populating PROCESSED_DATA_TBL
      STATUS_DESCRIPTION - The description of the STATUS of parsing and populating PROCESSED_DATA_TBL
      ROW_COUNT - Number of rows inserted into PROCESSED_DATA_TBL
    */

    BEGIN
      
    INSERT ALL INTO PROCESSED_DATA_TBL 
      
    (PD_ID, 
      STORE
    , 
      SALES_NBR
    , 
      UNIT_COST
    , 
      ST_FLAG
    , 
      ST_DATE
    , 
      ST
    , 
      START_QTY
    , 
      START_VALUE
    , 
      START_ON_ORDER
    , 
      HAND
    , 
      ORDERED
    , 
      COMMITED
    , 
      SALES
    , 
      RECEIVE
    , 
      VALUED
    , 
      ID_1
    , 
      ID_2
    , 
      ID_3
    , 
      UNIT_PRICE
    , 
      EFFECTIVE_DATE
    , 
      STATUS
    , 
      STATUS_DATE
    , 
      STATUS_REASON
    ) 
      
    VALUES (IDDATA 
      
    ,store 
      
    ,SalesNo 
      
    ,UnitCost 
      
    ,StWac 
      
    ,StDt 
      
    ,St 
      
    ,StartQty 
      
    ,StartValue 
      
    ,StartOnOrder 
      
    ,Hand 
      
    ,Ordered 
      
    ,COMMITED 
      
    ,Sales 
      
    ,Rec 
      
    ,Valued 
      
    ,Id1 
      
    ,Id2 
      
    ,Id3 
      
    ,UnitPrice 
      
    ,to_Date(EffectiveDate||' '||EffectiveTime, 'YYYY-MM-DD HH24:MI:SS') 
      
    ,'N'  
      
    ,SYSDATE 
      
    ,'XML PROCESS INSERT')  
    -- This is to parse and fetch the data from XML 
      
    SELECT E.* FROM XMLTABLE('rp_send/rp_sendRow' PASSING xDATA COLUMNS
      store VARCHAR
    (20) PATH 'store'  
      
    ,SalesNo VARCHAR(20) PATH 'sales' 
      
    ,UnitCost NUMBER PATH 'cost' 
      
    ,StWac VARCHAR(20) PATH 'flag' 
      
    ,StDt DATE PATH 'st-dt' 
      
    ,St NUMBER PATH 'st' 
      
    ,StartQty NUMBER PATH 'qty' 
      
    ,StartValue NUMBER PATH 'value' 
      
    ,StartOnOrder NUMBER PATH 'start-on-order' 
      
    ,Hand NUMBER PATH 'hand' 
      
    ,Ordered NUMBER PATH 'order' 
      
    ,Commited NUMBER PATH 'commit' 
      
    ,Sales NUMBER PATH 'sales' 
      
    ,Rec NUMBER PATH 'rec' 
      
    ,Valued NUMBER PATH 'val' 
      
    ,Id1 VARCHAR(30) PATH 'id-1' 
      
    ,Id2 VARCHAR(30) PATH 'id-2' 
      
    ,Id3 VARCHAR(30) PATH 'id-3' 
      
    ,UnitPrice NUMBER PATH 'unit-pr' 
      
    ,EffectiveDate VARCHAR(30) PATH 'eff-dt' 
      
    ,EffectiveTime VARCHAR(30) PATH 'eff-tm' 
      
    ) E;  
      ROW_COUNT 
    := SQL%ROWCOUNT;  -- Not the # of all the rows inserted.
      PROCESS_STATUS 
    := STATUS.PROCESSED;
      
    IF ROW_COUNT < 1 THEN   -- The insert failed Row Count = 0 No exception thrown
      PROCESS_STATUS 
    := STATUS.ERROR;
      STATUS_DESCRIPTION 
    := 'ERROR Did not insert into Pos Inventory. Reason Unknown';
      
    END IF;
      EXCEPTION
      
    WHEN OTHERS THEN
      ROW_COUNT 
    := 0;
      PROCESS_STATUS 
    := STATUS.ERROR;
      STATUS_DESCRIPTION 
    := 'SqlCode:' || SQLCODE || ' SqlErrMsg:' || SQLERRM;
    END;


    BEGIN
      DBMS_OUTPUT
    .enable(NULL);
     
    FOR A_NewStage IN NewStage
      LOOP
      READ_COUNT
    := READ_COUNT + 1;
      STAGE_TBL_PROCESS
    (A_NewStage.ID, A_NewStage.XML_DOCUMENT, PROCESS_STATUS, STATUS_DESCRIPTION, ROW_COUNT);
      INSERT_COUNT_TOTAL
    := INSERT_COUNT_TOTAL + ROW_COUNT;
      
    IF(ROW_COUNT <= 0 OR PROCESS_STATUS = STATUS.ERROR) THEN
      ERROR_COUNT
    := ERROR_COUNT + 1;
      
    UPDATE STAGE_TBL
      
    SET status  = PROCESS_STATUS,
      status_DATE 
    = SYSDATE,
      status_DESCRIPTION 
    = STATUS_DESCRIPTION
      
    WHERE ID  = A_NewStage.ID;
      
    ELSE
      
    UPDATE STAGE_TBL
      
    SET status  = PROCESS_STATUS,
      status_DATE 
    = SYSDATE,
      status_DESCRIPTION 
    = STATUS_DESCRIPTION,
      SHRED_DT 
    = SYSDATE
      
    WHERE ID  = A_NewStage.ID;
      
    END IF;
      
    COMMIT;
     
    END LOOP;
     
    COMMIT;
     
    IF ERROR_COUNT > 0 THEN
      ERRMSG
    := '** ERROR: ' || ERROR_COUNT || ' Stage records did not insert in to the Processed table correctly';
      RAISE_APPLICATION_ERROR
    (-20001,ErrMsg); 
     
    END IF;
      EXCEPTION
      
    WHEN OTHERS THEN
      RAISE
    ;
    END ;

    My
    XML with just one rp_sendRow element, it can go upto 2000 rp_sendRow elements
    <?xml version = \"1.0\" encoding = \"UTF-8\"?> 
    <rp_send xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> 
      
    <rp_sendRow> 
      
    <store>0123</store> 
      
    <sales>022399190</sales> 
      
    <cost>0.01</cost> 
      
    <flag>true</flag> 
      
    <st-dt>2013-04-19</st-dt> 
      
    <st>146.51</st> 
      
    <qty>13.0</qty> 
      
    <value>0.0</value> 
      
    <start-on-order>0.0</start-on-order> 
      
    <hand>0.0</hand> 
      
    <order>0.0</order> 
      
    <commit>0.0</commit> 
      
    <sales>0.0</sales> 
      
    <rec>0.0</rec> 
      
    <val>0.0</val> 
      
    <id-1/> 
      
    <id-2/> 
      
    <id-3/> 
      
    <unit-pr>13.0</unit-pr> 
      
    <eff-dt>2015-06-16</eff-dt> 
      
    <eff-tm>09:12:21</eff-tm> 
      
    </rp_sendRow> 
    </rp_send> 

    The issue I see is when I pass an XML object to a procedure (STAGE_TBL_PROCESS) to analyze its takes about 10 seconds per XML, but rather than from XML if I directly pick up table in the procedure (STAGE_TBL_PROCESS) passing the ID to be about 0.15 seconds.

    In version 11.1, Oracle introduced a new model of storage for the data type XMLType called XML binary.

    Binary XML become the default in 11.2.0.2, to disparage the old storage based on CLOB.

    Binary XML is a format optimized after analysis for the storage and treatment of the XQuery.

    When an XQuery expression is evaluated (through for example XMLTABLE) on an XMLType column stored as binary XML, Oracle can use an ongoing evaluation of XPath that surpasses the query even crushed a transitional XMLType of several order of magnitude.

    You can see that in the action plan of the explain command:

    SQL> SELECT E.*
      2  FROM stage_tbl t
      3     , XMLTABLE('rp_send/rp_sendRow' PASSING t.xml_document
      4         COLUMNS store VARCHAR(20) PATH 'store'
      5               , SalesNo VARCHAR(20) PATH 'sales'
      6               , UnitCost NUMBER PATH 'cost'
      7         ) E ;
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1134903869
    
    --------------------------------------------------------------------------------
    | Id  | Operation          | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |           |     1 |  2008 |    32   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |           |     1 |  2008 |    32   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| STAGE_TBL |     1 |  2002 |     3   (0)| 00:00:01 |
    |   3 |   XPATH EVALUATION |           |       |       |            |          |
    --------------------------------------------------------------------------------
    

    When the query is executed on a passenger XMLType (for example, a parameter, or a PL/SQL variable), Oracle cannot run the binary model and use a functional assessment based on memory of the XML DOM-like representation.

    You can see that in the plan to explain it by spoting a 'COLLECTION ITERATOR PICKLER FETCH' operation.

    So what explains the difference (in your version) between treatment from a column of XMLType (stored in binary XML format) or a variable or a parameter.

    From 11.2.0.4 and beyond, things have changed a bit with Oracle, introducing a new transitional level of optimization on XMLType.

    The plan of the explain command will show a "XMLTABLE ASSESSMENT' in this case.

  • Can I hide a book or entry in the table of contents, based on a parameter?

    Hi all. I am currently using RH 11.  Is there a way in which I can hide a book or entry in the table of contents, based on a parameter passed in the URL?

    Rh10 introduced dynamic content to the user, otherwise known as categories of content-centric. In an SSL, you can create different outputs. The idea is that aid is open with a drop down menu where the user can select a category. If you look in the output folder, there is a folder for each category and you can open this assistance to a specific category. However, the user can then select other categories.

    The method is described in the HR visit to my site and the projects in the sample have a SSL showing the method.

    To open a specific category, point you to the start page for the category, the name of the category. So the TypeA category can be open from TypeA.htm.

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • Build the name of guard of the table of the last element, but not the others. Workaround solution?

    Hello

    Sorry if this has been posted before, I did the search first, but can't find anything.

    Problem is that I have two configurations which are identical and must be ordered by a single vi. Given that they are the same, they are configured with the same sets of parameters so I decided to create a cluster of these and then build an array of clusters. In this way I need to use only a thread and if I need a given parameter I can get it easily from here (or so I thought) and also because I need to see if anything changes I can compare a thread instead of each of the parameters.

    The gui has the list of parameters, then in the block diagram I group them appropiately, using "Bundle name" and then each bundle in a table by using "build the table. Problem is when I have the index in the array for the first place of the configuration and usage to unbundle the parameters I need, using "ungroup by name" (although if I use "Unbundle" the same thing happens) and lo and behol, the output names come from the configuration of the second, not the first.

    Here's the curious thing, though, even if the names are all wrong, that the values are correct. I could live with that, but it's more boring it will be another very difficult user to understand the schema more this is just a proof of principle to test with two, eventually there will be eight or more and who's going to get really confusing.

    Is there a way to get around this? Even if it is to change the names after unbundling.

    Check the attached vi to see what I mean.

    I think you forget an important point on the tables.  The only thing that may be different between each element of a table is its value.  The elements in the array must all share the same properties.  This would therefore include the names of the different elements that make up the cluster that is a table element.

    It seems that the last group that builds in the table is the one that defines the names of the items that are in the element of the cluster.  You must give all elements of the array with the same name within the cluster.  Or use a cluster of clusters rather than a table of cluster to create your data structure.

Maybe you are looking for