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.

Tags: Database

Similar Questions

  • 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.

  • Pass the value to an ODI procedure

    Hello
    I need to pass the value of a variable ODI ODI procedure.
    Let me tell you what I did:
    (1) first make an ODI procedure and passing the name of the variable of ODI that I spend in the options of the procedures such as #V_Test.
    (2) now, I did the screenplay for this procedure.
    (3) next I used the scenario of the procedure in other ODI package and also added that the variables I have to spend in the procedures.
    (4) but now when I'm passing the values of the variables in this package, procedures is not accept the values.

    Please suggest.

    Thank you

    Select the scenario, and then go to the Properties tab. You will get an additional variable that you want to pass.
    Provide your value of the variable y

  • Wrong execution of a package within a procedure stored

    Oracle version: 10.2.0.4 RAC

    I posted the below problem in REPLICATION forum but I think he needs to be here. I think I'm having a problem with some "shade" of Oracle, which relates to the appellant a package in a regulation and immunities.

    Here is the original post:
    ================================================================================================

    Get an ora-12048 and ora - 942 when executing dbms_refresh.refresh in a stored procedure. When I invoke dbms_refresh.refresh directly from SQLPlus things work very well.

    Here is the header and the relevant code in the stored procedure:

    create or replace PROCEDURE p_mv_refresh (p_refgrp IN VARCHAR2) AS

    v_refgrp all_refresh_children.rname%TYPE;

    BEGIN
    v_refgrp: = UPPER (p_refgrp);
    DBMS_REFRESH. Refresh (v_refgrp);
    end;

    Here is the definition of the refresh Group:

    exec dbms_refresh.make (name = > 'BENEFITS_REFGRP',-)
    list = > 'MV_INDIVIDUAL_CUR, MV_CCR_CUR, MV_BUSINESS_DBA_CUR, -.
    next_date = > sysdate;
    interval = > NULL,--
    implicit_destroy = > FALSE;
    Lax = > FALSE;
    rollback_seg = > NULL,--
    push_deferred_rpc = > FALSE;
    refresh_after_errors = > FALSE;
    purge_option = > NULL,--
    parallelism = > 8, -.
    heap_size = > NULL);

    I run in SQLPLUS by passing the name of the refresh Group in the stored procedure:

    SQL > exec p_mv_refresh ('BENEFITS_REFGRP');

    And I get this:

    Error: ORA-12048: error in materialized view Refresh
    'UIMVIEWS '. "" MV_BUSINESS_DBA_CUR ".
    ORA-00942: table or view does not exist

    When I have exec dbms_refresh.refresh('BENEFITS_REFGRP') directly in SQLPlus, everything runs without failure.

    Here is the definition of MV:

    CREATE THE MV_BUSINESS_DBA_CUR MATERIALIZED VIEW
    ON PREBUILT TABLE
    COMPLETE REFRESH
    DISABLE THE QUERY REWRITE AS
    (SELECT *)
    OF xxxxxxxx...) ;

    There is no newspaper of MV on the source (no fast refresh) table.

    Table source and MV are same DB, different schemas.

    Just to be safe in tests, I attributed select privileges on the source table to the MV schema via a role and directly. Does not solve.

    New - the MV refreshes thin when done directly from a SQLPlus prompt. It fails only when I run it from within the stored proc.

    Thanks in advance for your suggestions...

    TonyG

    Here are additional info I posted:
    =========================================================================
    Here is an update - I tried the same procedure only this time replaced the call to dbms_refersh with a call to dbms_mview, just to see if he would run.

    This isn't. I am quite sure, I hit a kind of question of privilege that has to do with a package requiring a package, but I don't know enough with what it might be. dbms_mview works fine from the command line, just like the fact dbms_refresh.

    Here's what happened when I called the proc dbms_mview

    Error: ORA-12008: error in the path of refresh materialized view
    ORA-00942: table or
    view does not exist
    =========================================================================

    Thanks in advance for any help.

    A stored procedure does not inherit from grants of role, you must make grants directly to the relevant tables/views/mast views and can not give these permissions to the roles of througth.

    Date of arrival:
    http://download.Oracle.com/docs/CD/B10500_01/server.920/a96524/c24privs.htm#4770--> blocks named with copyright

    Published by: Pedro_gloria on 10-Dec-2010 07:54

  • 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

  • ROWID from a PLSQL procedure

    Hi guys,.

    I have a tabular presentation that allows the user to update and create lines.

    My form updates and creates a box for a warehouse system amounts.

    What I want to do is when the user creates a new box with a quantity of 10 to be able to call a package that I wrote to save this transaction in my table of transactions and when a box is reduced from 10 to 5, for example still create a transaction to call my package.

    What I am struggling with is how to move in the BOX_ID of tables in my procedure with the ID of the row in the tabular form that I've updated / created.

    For updating the amount of box I have the transaction must be able to get the amount of previous and new box Qty.

    For example

    To create:

    New line added to the database with a quantity of 5. Spend this new rowid and new box Qty in my procedure that will take care of the creation of the transaction.

    For an update:
    Old value 10, new value 5. Pass the rowid, old and new values in my procedure, which will be responsible for the creation of the transaction.

    The user could, in theory, add and update multiple records at once before they click on the submit"" button. I tried using triggers in the table, but I prefer to do in form as much as possible.

    Hope that make sense,

    PS - I use APEX v4.0

    I create a simple demonstration of what I am seeking to achieve is to:

    http://Apex.Oracle.com/pls/Apex/f?p=17551:8

    user guest1 name
    password demo

    There are 3 lines in the form, if the user changes the value of an area from 500 to 100, I want the form forward to my procedure the box stood at 500 and was reduced to 100 for this box_id.

    I also useful to call the procedure when a new box is created in the amount of this new box.

    Thanks in advance,
    Chris

    I'd say it's something that you should in a trigger (which would happen when I use the SQL workshop to insert a line...), but anyway:
    You can create your own insertion procedure, such as:
    Insert the rowid return table_x (val1, val2, val3) in l_rowid. And then use l_rowid to call your procedure. (or the box_id instead of the rowid, whatever you prefer)

  • Creating views, dynamic SQL within stored procedure

    I'm having a problem with the creation of dynamic views of in a stored procedure. The following declare block works fine:

    DECLARE
    parameter i_nom_table varchar2 (200): = 'abc ';
    xyz cursor script, SELECT step
    STARTING from scripts
    WHERE table_name = i_nom_table parameter
    ORDER BY step CAD;
    l_sql scripts.script%TYPE;
    l_step scripts.step%TYPE;
    l_error VARCHAR2 (200);
    l_code VARCHAR2 (200);
    Start
    XYZ OPEN;
    LOOP
    XYZ-FETCH INTO l_step, l_sql;
    OUTPUT WHEN xyz % NOTFOUND;
    immediately run l_sql;
    insert into ingest_log values (null, sysdate, i_nom_table, l_step, l_sql, 'Success' parameter);
    END LOOP;
    CLOSE XYZ;
    insert into ingest_log values (null, sysdate, parameter i_nom_table, 0, "Accomplished all the steps.", "Success");
    EXCEPTION WHEN OTHERS THEN
    l_error: = substr (SQLERRM, 1, 200);
    l_code: = SQLCODE;
    insert into ingest_log values (null, sysdate, parameter i_nom_table, l_step, l_sql, l_code |) ' - ERROR - ' | l_error);
    END;

    However, if I create a procedure with this block and try to run it I get an insufficient privileges error. Do not know why. All tables, views, procedures are under the same user, and the user that I'm connected as the runtime of the declare block. The user has the following privileges:

    Connect, resource, xdbadmin, s/n

    Any reason you can think of for this? Script values are generally "CREATE OR REPLACE VIEW As.... » ;

    Permissions in Oracle to do indirectly through roles are not available when compiling packages, functions, and stored procedures. Direct subsidies are required during the creation of these objects in the database.

    http://articles.TechRepublic.com.com/5100-10878_11-6183799.html

  • call sub procedure for updating the table - need help

    Hi all

    I have a scneario wherein I get three values 0,2.5 and 57.
    For each value, I'll call another procedure that updates a table "sample_dest".
    The "sample_dest" table has a column "dest_nbr."

    Now, for each three values I get,
    I want to update only one record in the table 'sample_dest '.

    for example, I want to update the column "dest_nbr" with a value of 59.5 (0 + 2.5 + 57).

    I am unable to do this, because every time the procedure is called,
    the previous values are not stored. 57 is the last value I get,
    I am able to store only 57. But I want 59.5 to be updated in the table.

    How can I achieve this.
    Help, please.

    Concerning
    Rambeau.

    This should be done in a single sql statement, not in a loop of cursor (which is what it looks like you're doing). If sample_desc already contains records for samples, so it should look like:

    UPDATE sample_desc sdesc
    SET desc = (SELECT AVG(code) FROM sample_dest sdest
                WHERE sdesc.sample = sdest.sample)
    WHERE EXISTS (SELECT 1 FROM sample_dest sdest
                  WHERE sdesc.sample = sdest.sample)
    

    If sample_desc does not already contain records (unknown from your description), then it would be an insert as:

    INSERT INTO sample_desc
    SELECT sample, AVG(code)
    FROM sample_dest sdest
    GROUP BY sample
    

    John

  • Unable to print an invoice from within a Web page.

    Original title: device error message

    Unable to print an invoice from within a Web page.

    using network printer.

    Hi ColinBall,

    1. are you able to print other Web pages and other documents?

    2. you receive messages or error codes?

    If you are facing the issue when you try to print from Internet Explorer, you can read the following article and see if it helps.

    I can't print or preview before printing a Web page in Internet Explorer

    Hope this information is useful.

  • Using the procedure to display the table of multiple data

    Hi, I need help for the procedure in oracle

    I want to create the procedure to display the table of multiples with sample plan

    with a parameter imployee_id to display an employee_id, name, function, start_date, end_date

    IAM using this query to select more than one table

    SELECT e.employee_id, e.first_name, j.job_title, h.start_date, h.end_date

    E EMPLOYEES

    JOIN j jobs

    ON j.job_id = e.job_id

    JOIN the job_history:

    ON h.employee_id = e.employee_id

    WHERE e.employee_id = 200;

    Thanks for the help

    Blu and Billy showed you the 'real' solution. You can display the data returned by a cursor ref in SQL Developer, too:

    http://www.thatjeffsmith.com/archive/2011/12/SQL-Developer-tip-viewing-refcursor-output/

    Yet as a duty for a beginner is generally do not have the expected solution. Usually, teachers want to see you using a LOOP and dbms_output. something like

    DECLARE

    Xy CURSOR IS

    SELECT whatever

    As much as;

    BEGIN

    FOR r IN xy LOOP

    dbms_output.put_line (r.col1 |' # ' | r.col2);

    END LOOP;

    END;

    Of course this suggestion will inaugurate a discussion abusing DBMS output but I keep my position that it is authorized to use it for learning the basics.

  • [ADF, JDev12.1.3] How 1) in order to avoid this af:table created from a VO istance automatically fill the box itself? (2) disable a button if the display: table is empty?

    Hallo,

    I would like to know how to avoid that an af:table created from a VO istance automatically fill the area itself.

    I need to fill programmatically after you click on the search button.

    Then I would turn off, and the button 'open file' if the af: table is empty or if af:table contains documents... enable how can achieve this?

    Thank you

    Federico

    I would like to know how to avoid that an af:table created from a VO istance automatically fill the area itself.

    I need to fill programmatically after you click on the search button.

    Use VO.executeEmptyRowSet () Andrejus Baranovskis Blog: Oracle ADF Tuning: prevention of the execution of the SQL query on the loading of the Page

    Then I would turn off, and the button 'open file' if the af: table is empty or if af:table contains documents... enable how can achieve this?

    Bind "disabled" property #{bindings.yourIterator.estimatedRowCount == 0}

    Dario

  • Most of the fonts Typekit and WebFonts (Wf) not selectable from within the Muse?

    Hey! Seems to be a bug with fonts of the Muse?

    When I go to select some fonts (Typekit and Webfonts), they are not yet selectable from within the Muse. Even a font that I just downloaded in the "Add web fonts" menu does not work...

    Here is a screencast to show you what I mean (I'm clicking on each policy as you see me go down the list in order):

    http://screencast.com/t/pGxQEMd7FQd

    What is happening and what is the reference for this?

    Thanks for any help!

    Please see here:

    https://forums.Adobe.com/thread/1691738

    Thank you

    Sanjit

  • Appeal of a variable from within an AS3 movieclip in Flash CS4

    I'm trying to back up a string variable from within a movieclip that is in an another movieclip on the main timeline to help:

    trace (VariableString);

    and also

    trace (stage. VariableString);

    No work

    The variable is a textfield of entry as well as traces very well when it is on the main timeline, but won't work inside the movieclip. I am using Actionscript 3 in Flash CS4.

    I appreciate this has probably been discussed before on this forum but I can't find an answer of difinitve that seems to work.

    Thank you

    When I put "MovieClip (root)" I tried that literally... not MovieClip1 (root).  You will need to cast to the class of the root object, who, most often using MovieClip() enough (among others, like object).

    What I don't see is happening is that you be able to get the value of the text of MovieClip1 the way that you say you do.  If MovieClip1 contains a text input component, then to get the value of this text you need to target the text property of the element inside the MovieClip1, as in...

    VariableString1 = MovieClip1.textInputName.text.

  • Access to a link from within a servlet

    Hey all,.
    If I try to access a link from a servlet instead of use the ApplicationModule approach which is recognized as a bad idea (http://blogs.oracle.com/jdevotnharvest/2010/11/when_to_use_createrootapplicationmodule_in_oracle_adf.html). However, when the code runs in servlet line BindingContent.getCurrentBindingsEntry () returns null. I think that there is something missing in my setup which is originally ADFm to not recognize the servlet as having a binding file. Something stand out?

    So within a servlet, I have the following:

    SerializableAttribute public class RSSNewsServlet extends HttpServlet {}
    public void doGet (HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {}
    BindingContext bctx = BindingContext.getCurrent ();
    BindingContainer links = bctx.getCurrentBindingsEntry ();
    DCBindingContainer bindingsImpl = (DCBindingContainer) links;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("AllPapers1Iterator");
    Rank [] rows = dciter.getAllRowsInRange ();
    ...
    }
    }

    Web.XML:
    < filter mapping >
    < filter-name > adfBindings < / filter-name >
    < name servlet - > NewsServlet < / servlet-name >
    < name servlet - > Faces Servlet < / servlet-name >
    < distributor > BEFORE < / dispatcher >
    < distributor > APPLICATION < / dispatcher >
    < / filter-mapping >
    ....
    < servlet >
    < name servlet - > NewsServlet < / servlet-name >
    < servlet-class > < servlet path >. RSSNewsServlet < / servlet-class >
    < / servlet >
    ...
    < servlet-mapping >
    < name servlet - > NewsServlet < / servlet-name >
    /servlet/news.RSS < url-pattern > < / url-pattern >
    < / servlet-mapping >
    newsServletPageDef.xml:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < pageDefinition xmlns = "http://xmlns.oracle.com/adfm/uimodel."
    version = "11.1.1.56.60" id = "newsServletPageDef".
    Package = "< path pagedefs > pageDefs" >
    < Settings / >
    <>executables
    < variableIterator id = "variables" / >
    < iterator lie = "AllPapers1" RangeSize = "25".
    DataControl = "GatewayNewsAppModuleDataControl."
    ID = "AllPapers1Iterator" / >
    < / executables >
    < links >
    < Tree IterBinding = "AllPapers1Iterator" id = "AllPapers1" >
    < nodeDefinition DefName = "< path-to-model > AllPapers.
    Name = "AllPapers10" >
    < AttrNames >
    < point Value = "PapId" / >
    < point Value = "PapTitle" / >
    < point Value = "PapPublishDate" / >
    < point Value = "PapExpireDate" / >
    < point Value = "PapAuthor" / >
    < point Value = "PapType" / >
    < point Value = "PapIssueDate" / >
    < point Value = "PapFileName" / >
    < point Value = "PapUserName" / >
    < point Value = "PapPostedDate" / >
    < point Value = "PapModifiedDate" / >
    < point Value = "PapNeverExpire" / >
    < point Value = "PapFile" / >
    < / AttrNames >
    < / nodeDefinition >
    < / tree >
    < / links >
    < / pageDefinition >

    DataBindings.cpx:

    < pageMap >
    ...
    "< path="/servlet/news.rss page "usageId ="MyAlmacTemplate_view_newsServletPageDef"/ >
    ...
    < / pageMap >
    < pageDefinitionUsages >
    ...
    < page id = "MyAlmacTemplate_view_newsServletPageDef".
    path = "com. Almac.Aurora.Gateway.pageDefs.newsServletPageDef"/ >
    ...
    < / pageDefinitionUsages >

    When the code runs in servlet line BindingContent.getCurrentBindingsEntry () returns null.

    The BindingContext.getCurrentBindingsEntry () method returns the requestScope variable with key "bindings". When using ADF Faces, this variable is set during model prepare ADF Faces (by the method of PageLifecycleImpl.prepareModel ()). But when you use a simple servlet that variable is not set (because the lifecycle page ADF Faces is not running) and this is the reason why you get a null result. To work around the problem, you can use the following code in your servlet:

    BindingContext bctx = BindingContext.getCurrent();
    DCBindingContainer pagedef = bctx.findBindingContainerByPath(request.getServletPath());
    bctx.setCurrentBindingsEntry(pagedef); // Invoke this method only if for some reason you need the "bindings" variable set in the environment
    

    Dimitar

  • Can a Web Service being consumed from within JSX

    Hi all

    In CS5, can a web service being consumed from within JSX and if so - how?

    TIA,

    mlavie

    http://Rorohiko.blogspot.com/2008/07/Lightning-Brain-podcast-click-here-to.html

    gives details on how to connect to HTTP taken. I regularly use this as a starting point to connect to SOAP services and so on...

    See you soon,.

    Kris

Maybe you are looking for

  • M300-101: can I install Win Xp Prof?

    Hello can I install on Win Xp Prof M300 (but not the tablet version)? I must not have English version... If I now Toshiba does not sell M300 with multi language pack... If I install standard XP Prof. it'll be some problems with drivers or something?

  • Photos slideshow background music

    I create a slideshow of pictures to show at a birthday party.  Have about 400 photos in an Album and it is great when they go through.  Now to create a music playlist in music from Apple to play with slide show (I've done many times before in iPhoto)

  • Ganga 81945GM-RH motherboard

    PC: HP Compaq dx2280MT Motherboard: Ganga 81945GM-RH OS: Windows XP - SP3 Let me know on compatible processors for the above motherboard. I searched all over the internet, but have failed to get information on the motherboard. I want to improve my CP

  • Acer veriton m series. Freezes randomly, error msg 'itunes library not saved, insufficient disk space '.

    My Acer Veriton M290 randomly goes into 'critical' mode and starts flashing and error messages, i.e. "not saved itunes library, not enough disk space.  "can't open the Task Manager, close some programs and try again" (and there will be no programs ru

  • Windows has been slow to open and load since download IE8.

    Original title: slow loading. Windows has been slow to open and load since download IE8