Dynamic insertion within the procedure error


Hi all

I use under oracle database on HP - UX.

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE Production 10.2.0.5.0
AMT for HP - UX: 10.2.0.5.0 - Production Version
NLSRTL Version 10.2.0.5.0 - Production

I'm not able to run the procedure below and it returns the error. The insert in the procedure returns error. If I execute manually only the insert statement, it works well.
Can someone help me with this issue?

Procedure
===========
create or replace procedure test_proc
as
v_sql varchar2 (2000);
Start
v_sql: =' insert into TABLE1 (select owner, object_type, object_name, "S", "Y" of dba_objects@LINK1 )
where owner = "ABC" and object_type = "TABLE" less
Select the owner, object_type, object_name, "S", "Y" from dba_objects where owner = "ABC" and object_type = "TABLE") ';

immediately run v_sql;
commit;
end;
/

exec test_proc;

Error:
===========

ERROR on line 1:
ORA-00942: table or view does not exist
ORA-06512: at "SYSTEM. TEST_PROC", line 8
ORA-06512: at line 1

user running this procedure doesn't have permission to read data from DBA_OBJECTS. Grant select permission on that to the user running this procedure and it should work.

Onkar

Tags: Database

Similar Questions

  • Data recovery before the insert in the procedure

    Hello
    I'm new in plsql programming and I'd like to do a procedure. I have tables like the following table1:

    | COL1 | COL2. COL3 | COL4 | COL5 | COL6 | COL7 |
    | 600. 140. 2. 10. 1300 | 500 | 1.
    | 600. 140. 2. 20. 1400 | 340. 4.
    | 600. 140. 2. 15. 1400 | 230. 3.
    | 600. 140. 2. 35. 1700 | 120. 2.
    | 600. 150. 3. 10. 1300 | 166. 6.
    | 600. 150. 3. 15. 1400 | 435. 5.

    For the same COL1 and COL2/COL3, check out the selection of different values of COL4
    For example, for COL1 = 600, COL2 = COL3/140 = 2 and COL2 = COL3/150 = 3
    Return not common 20 and 35 as values


    Then insert the rows in this table TABLE1
    600, 150, 3, 20, 1400, 340, 7
    600, 150, 3, 35, 1700, 120, 8


    I'm doing the procedure as below but I have problem how to recover data in the insert statement

    PROCEDURE COPY_COLUMNS  ( P_COL1        IN  A.COL1%TYPE,
                              P_FROM_COL2   IN  B.COL2%TYPE,
                              P_FROM_COL3   IN  B.COL3%TYPE,
                              P_TO_COL2     IN  B.COL2%TYPE,
                              P_TO_COL3     IN  B.COL3%TYPE,
                              P_FLG1        IN  VARCHAR2,
                              P_FLG2        IN  VARCHAR2,
                              P_FLG3        IN  VARCHAR2                                      
                                         ) IS
    
    CURSOR CFL1 IS select COL4
        FROM TABLE1
        WHERE COL1 = P_COL1 AND COL2 = P_FROM_COL2 AND COL3 = P_FROM_COL3
        MINUS
        select COL4
        FROM TABLE1
        WHERE COL1 = P_COL1 AND COL2 = P_TO_COL2 AND COL3 = P_TO_COL3;
    
    
    CURSOR CFL2 IS select COL4
        FROM TABLE2
        WHERE COL1 = P_COL1 AND COL2 = P_FROM_COL2 AND COL3 = P_FROM_COL3
        MINUS
        select COL4
        FROM TABLE2
        WHERE COL1 = P_COL1 AND COL2 = P_TO_COL2 AND COL3 = P_TO_COL3;
    
    
    CURSOR CFL3 IS select COL4
        FROM TABLE3
        WHERE COL1 = P_COL1 AND COL2 = P_FROM_COL2 AND COL3 = P_FROM_COL3
        MINUS
        select COL4
        FROM TABLE3
        WHERE COL1 = P_COL1 AND COL2 = P_TO_COL2 AND COL3 = P_TO_COL3;  
    
    
    V_REC        CFL1%ROWTYPE;
    
    
    BEGIN
    
    
    IF P_FLG1='N' OR P_FLG2='N' OR P_FLG3='N' THEN
        GOTO label; --do nothing
    END IF;
    
    
    IF P_FLG1 = 'Y' THEN
    
        OPEN CFL1;
        FETCH CFL1 INTO V_REC;
        CLOSE C1;
    
    --    SELECT COL5, COL6
    --    FROM TABLE1
    --    WHERE COL1 = P_COL1 AND COL2 = P_FROM_COL2 AND COL3 = P_FROM_COL3 AND COL4 = V_REC.COL4;
    
    
        FOR REC IN CFL1 LOOP
            INSERT INTO TABLE1 
                SELECT P_COL1, P_TO_COL2, P_TO_COL3, CFL1.COL4, -- COL5 ?? , COL6 ?? -- , SEQname2.NEXTVAL) 
    
    
        END LOOP;
    
    END IF;
    
    <<label>>
    END;
    

    Could you help me please do so?
    Thanks in advance

    And if you want to insert the missing values COL4 both sense, use of full join, as I've already shown (slightly modified):

    SQL > insert
    2 in table1
    3 values (600,150,3,70,1500,567,8)
    4.

    1 line of creation.

    SQL > insert
    2 in table1
    3 values (600,150,3,90,1900,789,9)
    4.

    1 line of creation.

    SQL > select *.
    2 from table1
    3.

    COL1 COL2 COL3 COL4 COL5 COL6 COL7
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
    600 140 2 10 1300 500 1
    600 140 2 20 1400 340 4
    600 140 2 15 1400 230 3
    600 140 2 35 1700 120 2
    600 150 3 10 1300 166 6
    600 150 3 15 1400 435 5
    600 150 3 70 1500 567 8
    600 150 3 90 1900 789 9

    8 selected lines.

    SQL > insert
    2 in table1
    3 with t1 as)
    4 Select
    5 from table1
    6 where col1 =: P_COL1
    7 and col2 =: P_FROM_COL2
    8 and col3 =: P_FROM_COL3
    9 and: P_FLG1 = 'Y '.
    10              ),
    11 t2 as)
    12. Select *.
    13 from table1
    14 where col1 =: P_COL1
    15 and col2 =: P_TO_COL2
    16 and col3 =: P_TO_COL3
    17 and: P_FLG1 = 'Y '.
    18              )
    19 select: P_COL1 col1,.
    nvl2(t1.col4,:P_TO_COL2,:P_FROM_COL2) 20 col2,
    nvl2(t1.col4,:P_TO_COL3,:P_FROM_COL3) 21 col3,
    22 nvl (t1.col4, t2.col4) col4,
    NULL, 23
    NULL, 24
    25 null
    26 of t1
    join full 27
    28                t2
    29 on t2.col4 = t1.col4
    30 where the t1.col4 is null
    31 or t2.col4 is null
    32.

    4 lines were created.

    SQL > select *.
    2 from table1
    3.

    COL1 COL2 COL3 COL4 COL5 COL6 COL7
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
    600 140 2 10 1300 500 1
    600 140 2 20 1400 340 4
    600 140 2 15 1400 230 3
    600 140 2 35 1700 120 2
    600 150 3 10 1300 166 6
    600 150 3 15 1400 435 5
    600 150 3 70 1500 567 8
    600 150 3 90 1900 789 9
    600 140 2 70
    600 140 2 90
    600 150 3 35

    COL1 COL2 COL3 COL4 COL5 COL6 COL7
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
    600 150 3 20

    12 selected lines.

    SQL >

    SY.

  • Tuninng performance for cursor and insert in the procedure

    Hi all

    I need to set the oracle procedure. The procedure is as below.

    CREATE OR REPLACE PROCEDURE XYZ
    AS

    CURSOR ABCD_CUR IS
    SELECT a, b, c and d
    OF ABCD;
    RV_abcd ABCD_CUR % TYPE;

    BEGIN
    OPEN abcd_cur.
    loop
    extract the abcd_cur in rv_abcd;
    out on abcd_cur % NOTFOUND;
    BEGIN
    insert into one
    (
    SEQ_ID,
    A
    )
    VALUES
    (
    A_SEQ. NEXTVAL,
    rv_abcd. A
    );

    Insert into B
    (
    REF_SEQ_ID,
    SEQ_ID,
    B
    )
    VALUES
    (
    A_SEQ. CURVAL,
    B_SEQ. NEXTVAL,
    B
    );

    Insert into C
    (
    REF_SEQ_ID,
    SEQ_ID,
    C,
    D
    )
    values
    (
    A.SEQ. CURVAL,
    C_SEQ. NEXTVAL,
    C,
    D
    );
    EXCEPTION

    END;
    EXCEPTION
    END;


    the cursor query may sing either query or a query to join.

    For a single query, I used advice PARALLELS. but I'm not able to find out which suggests that I can use to join as well as what suspicion that I have to use for the INSERT statement.
    also, in addition to and delete, can what advice we use?

    Your entire code can be narrowed in a single SQL

    insert all
      into a(seq_id, a) values (a_seq.nextval, a)
      into b(REF_SEQ_ID, seq_id, b) values (a_seq.currval, b_seq.nextval, b)
      into c(ref_seq_id, seq_id, c, d) values (a_seq.currval, c_seq.nextval, c, d)
    select a, b, c, d
      from abcd
    
  • Form on the procedural error

    Hello
    I create a do_post procedure in my pattern and I have created a page using the "form on the procedure," Wizard
    When creating the form, I can choose the steps in the wizard and the form was created successfully.
    But when I run the page and click submit, the error
    ORA-06550: line 1, column 7: PLS-00221: 'DO_POST' is not a procedure or is undefined ORA-06550: line 1, column 7: PL/SQL: statement ignored
    you are prompted.

    Anyone know is there any step I missed?

    Thank you

    Vincent Pek

    Vincent:

    You must create a procedure and not a function

    CREATE or replace procedure test (vtest varchar2)
    Result varchar2 (5);
    Start
    Result: = '1234';
    Return (result);
    end test;

    CITY

  • Insert the procedural error

    I wrote an insert procedure. It shows some errors.
    This is the query.

    create or replace PROCEDURE SP_MEMBERS_IN)
    P_MEM_ID IN MEMBERS. MEM_ID,
    P_MEM_NAME IN MEMBERS. MEM_NAME,
    P_B_DAY IN MEMBERS. B_DAY,
    p_address in MEMBERS. ADDRESS

    *)*
    AS
    BEGIN
    INSERT INTO MEMBERS (MEM_ID, MEM_NAME, B_DAY, ADDRESS)
    VALUES (P_MEM_ID, P_MEM_NAME, P_B_DAY, P_ADDRESS);
    COMMIT;

    END SP_MEMBERS_IN;

    Here are the errors.
    Error (1): PL/SQL: analysis of completed Compilation unit
    Error (2.1): PLS-00488: invalid variable declaration: object ' MEMBERS. MEM_ID' must be a type or subtype

    Can someone help me fix it please?

    create or replace PROCEDURE SP_MEMBERS_IN)
    P_MEM_ID IN MEMBERS. MEM_ID % TYPE,
    P_MEM_NAME IN MEMBERS. MEM_NAME % TYPE,
    P_B_DAY IN MEMBERS. B_DAY % TYPE,
    p_address in MEMBERS. ADDRESS TYPE %

    )
    AS
    BEGIN
    INSERT INTO MEMBERS (MEM_ID, MEM_NAME, B_DAY, ADDRESS)
    VALUES (P_MEM_ID, P_MEM_NAME, P_B_DAY, P_ADDRESS);
    COMMIT;

    END SP_MEMBERS_IN;

    you forget to put % TYPE in the settings variable declaration

  • 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

  • A loop dynamic sql in the procedure

    Hi guys,.

    I'm having a procedure that will have two input start_date and end_date parameters

    I need a loop in alter procedure statement something like this using dynamic sql


    CHANGE TABLE M1

    SWAP PARTITION FOR (TO_DATE('01-JAN-2015','dd-MON-yyyy'))

    WITH TABLE T2

    INCLUDING THE INDEX;

    CHANGE TABLE M1

    BY EXCHANGE COMPETITION FOR (TO_DATE('02-JAN-2015','dd-MON-yyyy'))

    WITH TABLE T3

    INCLUDING THE INDEX;

    .

    .

    .


    For example I have dates in setting something like January 1, 2015-4 January 2015

    I need something like this, where T is a constant variable, I need to add T1, T2. T3 according to the dates of the range.

    Hello

    your procedure can not simply be rolled up, but the call session can be rolled up the output to a file.

    Try something like this

    col act_date noprint new_value act_date
    
    SET TERMOUT  OFF
    
    select to_char(sysdate, 'yyyy_mm_dd_hh24miss') act_date
      from dual;
    
    SET TERMOUT      ON
    set serveroutput on
    set feedback     off
    set linesize     3000
    
    col statement for a200 heading "-- alter statements"
    
    spool d:\temp\&act_date._&_CONNECT_IDENTIFIER._alter_partition.sql
    
    -- exec your_procedure
    
    -- or simple plain sql
    
    with data (start_date, end_date) as (
      select to_date('01/01/2016', 'dd/mm/yyyy'),
            to_date('05/01/2016', 'dd/mm/yyyy')
        from dual
        )
    select --level, to_char(start_date + (level - 1), 'dd-MON-yyyy' ) cur_date
                     'ALTER TABLE M1 EXCHANGE PARTITION FOR (TO_DATE(''' || to_char(start_date + (level - 1), 'dd-MON-yyyy' ) || ''',''dd-MON-yyyy'')) WITH TABLE T2 INCLUDING INDEXES;'
      || chr(10) ||  'ALTER TABLE M1 EXCHANGE PARTITION FOR (TO_DATE(''' || to_char(start_date + (level - 1), 'dd-MON-yyyy' ) || ''',''dd-MON-yyyy'')) WITH TABLE T3 INCLUDING INDEXES;'  as statement
      from data
    connect by level <= end_date - start_date + 1;
    
    spool off
    
    set feedback    on
    
    prompt @d:\temp\mk_alter.sql
    

    concerning
    Kay

  • What's wrong with the dynamic region within the static region

    Hi all

    I use Jdeveloper 12 c

    I do app with a jsf page (man.jsf) contains the static region (xxx.jsff)

    the static region contains a dynamic region and I define the scope in the tent (adfc-config) (backingbean extended, scope of the request, see scope)

    the result is main.jsf is empty

    hand. JSF > > xxx.jsff (static region) > > bb.jsff (dynamic region)

    http://127.0.0.1:7101/face/hand? _afrLoop =

    What is the solution for this problem.

    Hello

    Actually the managed bean used by the static region should be extended to at least view. The managed bean should be defined in the configuration of the workflow of the static region.

    Frank

  • How to fill out the list for inserts in the procedure?

    I want to populate a list for a string of inserts.  All pads are the same except each iteration will change by this list.

    inserting into table X (A, B) values (1,2);

    In my case, I want to change the value each time column 2.

    So, something like this:

    DECLARE

    v_species varchar2 (10);

    CURSOR spec_code_cur is

    This is an example of my list... I need to get into the cursor.  I thought to use the double, but it did not work.  They do not live in any table yet, so I can't question.

    ACGL,

    AGCR,

    ALINT,

    ARTR2,

    IDEC,

    CEVEV4

    BEGIN

    FOR v_species in spec_code_cur

    LOOP

    insert into nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off)

    values ('450DB4460A7449B0E0440003BA9ECAD1',v_species, 'ON');

    END LOOP;

    END;

    /

    The desired output would be for inserts run as:

    insert into nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off)

    values ('450DB4460A7449B0E0440003BA9ECAD1','ACGL', 'ON');

    insert into nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off)

    values ('450DB4460A7449B0E0440003BA9ECAD1','AGCR', 'ON');

    insert into nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off)

    values ('450DB4460A7449B0E0440003BA9ECAD1','ALINT', 'ON');

    insert into nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off)

    values ('450DB4460A7449B0E0440003BA9ECAD1','ARTR2', 'ON');

    insert into nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off)

    values ('450DB4460A7449B0E0440003BA9ECAD1','CEDI', 'ON');

    insert into nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off)

    values ('450DB4460A7449B0E0440003BA9ECAD1','CEVEV4', 'ON');

    I thought that the dual purpose was to pull information from "thin air"... but it does not work.

    Thank you.

    If you pass the input as a single string set, you can do that.

    WITH T1 AS)

    SELECT "ACGL AGCR, ALINT, CEVEV4, IDEC, ARTR2" COL1 OF DOUBLE)

    SELECT ' INSERT INTO nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off) VALUES (')

    || CHR (39) | ' 450DB4460A7449B0E0440003BA9ECAD1' | CHR (39) | «, » || CHR (39) | REGEXP_SUBSTR(COL1,'[^,]+',1,LEVEL) | CHR (39) | «, » || CHR (39) | ' WE '. CHR (39) |') ;'

    FROM T1

    CONNECT BY LEVEL<=>

    OUTPUT:

    INSERT INTO nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off) VALUES ('450DB4460A7449B0E0440003BA9ECAD1', "ACGL", "ON");

    INSERT INTO nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off) VALUES ('450DB4460A7449B0E0440003BA9ECAD1', "AGCR", "ON");

    INSERT INTO nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off) VALUES ('450DB4460A7449B0E0440003BA9ECAD1', 'ALINT', 'ON');

    INSERT INTO nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off) VALUES ('450DB4460A7449B0E0440003BA9ECAD1', "ARTR2", "ON");

    INSERT INTO nrtx_taxa_list_items (txlstdef_cn_fk, symbol_fk, on_off) VALUES ('450DB4460A7449B0E0440003BA9ECAD1', 'CÉDI', 'ON');

  • Function within the package error

    Hi friends,

    I have a package called xxhw_ams_utils with a function inside get_salary

    When I tried to run this function in the package as below average way, im getting error as
    ORA-00904: "XXHW_AMS_UTILS." "" GET_SALARY ": invalid identifier
    select apps.xxhw_ams_utils.get_salary(1072) from dual
    where there are 1072 is the assignment IM id to the objective test.

    This is the actually the get_salary function located in the package xxhw_ams_utils of coding
    FUNCTION get_salary
    (p_asg_id IN NUMBER)
        RETURN VARCHAR2 IS
        
    l_gross VARCHAR2(20);
    l_basic VARCHAR2(20);
    
    BEGIN
    
    select eev.screen_entry_value
    into l_basic
           from   pay_element_entry_values_f eev,
                  per_pay_bases              ppb,
                  pay_element_entries_f       pe
           where  ppb.pay_basis_id  +0 = 61
           and    pe.assignment_id     = 1072
           and    eev.input_value_id   = ppb.input_value_id
           and    eev.element_entry_id = pe.element_entry_id
           and    sysdate between
                            eev.effective_start_date and eev.effective_end_date
           and    sysdate between
                            pe.effective_start_date and pe.effective_end_date;
    EXCEPTION
    WHEN OTHERS THEN RAISE;
    END; 
    Suppose that if I performed as the way to way below, I get the correct result
    select eev.screen_entry_value
    --into l_basic
           from   pay_element_entry_values_f eev,
                  per_pay_bases              ppb,
                  pay_element_entries_f       pe
           where  ppb.pay_basis_id  +0 = 61
           and    pe.assignment_id     = 1072------------------------------------>assignment id (that im passing)
           and    eev.input_value_id   = ppb.input_value_id
           and    eev.element_entry_id = pe.element_entry_id
           and    sysdate between
                            eev.effective_start_date and eev.effective_end_date
           and    sysdate between
                            pe.effective_start_date and pe.effective_end_date;
    Suppose if I run as the means below it is back as invalid character error.
    select apps.xxhw_ams_utils.get_salary(1072) from dual
    Why might the problem friends.

    Brgds,
    Mini

    Your function must RETURN a VARCHAR2

  • How to filter data in cursors within the procedure

    Hello

    Yesterday, I tried all night, but couldn't do it.

    I know that is incomplete, I just want to know how to filter the data based on the setting in

    Basically, here I want to get only the records that match the id_fichier


    create or replace PROCEDURE clearing_details (p_file_id in varchar2)
    IS
    strStatusCode VARCHAR2 (6);
    CURSOR PD1 IS
    SELECT COUNTRY_CODE, EOD_MARK OF LINK_STATUS WHERE FILE_ID is p_file_id


    Can someone help me on this please:


    Thanks for reading.

    Does do the same if you run the query itself in SQL * Plus with the same value you pass as a parameter?

    Without seeing your data and which parameter you're passing, we will fight help more as the concept itself works great as you have been demonstrated.

  • insufficient privileges when you create sequence using the procedure

    CREATE OR REPLACE PROCEDURE schema1.proc1 AS
    BEGIN
    EXECUTE IMMEDIATE 'DROP SEQUENCE schema1.add_ins_seq';
    EXECUTE IMMEDIATE 'CREATE SEQUENCE schema1.add_ins_seq MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 1000 NOORDER  NOCYCLE';
    END;
    

    This procedure is created to schema1 by schema1.

    Schema1 boasts a CREATE SEQUENCE privilege.

    When I run this procedure through SQL Developer after the Cup to schema1, the error is thrown in insufficient privilege to CREATE SEQUENCE, however, DROP SEQUENCE is executed. I can create the sequence without the procedure call.

    If I add AUTHID CURRENT_USER so I don't get the error of insufficient privileges.

    Why it gives this error when the owner and the applicant of the procedure is schema1?

    Hello

    1st thing to know: when a procedure is defined (and updated), any privileges granted through ROLE is not taken into account. This is because these privileges can be active or not at the level of the session (as happens if for example a user has active 'role A' in session 1 but not in session 2 and if this role has been used to define a procedure?) The proecedure must at the same time be VALID in session 1 and INVALID session 2? Is not possible.

    Thus, for instance in a situation of 'standard': user SYSTEM has 'DBA Rôle', so you can for example make a sqlplus session "SELECT * v $ instance;", but you would write a procedure owned by system making instance_name SELECT INTO l_variable OF v$ instance;  "then"surprise": the procedure cannot be compiled because of the ORA-904 Table or view does not exist..." To be able to create the procedure, a DSS system needs to be done.

    2nd thing for your special case, a little more complex: default for a procedure is 'AUTHID DEFINE', but once more: it means "privileges of the author creating the procedure", so without taking into account the acquired privileges through roles... Your user name is 'sequence create' through a role, it cannot use the privilege within the procedure.  But... but when you define the procedure with AUTHID CURRENT_USER, privileges are evaluated at run time, and thanks to the active ROLE in the session by calling the procedure, at this time, the user can create the sequence.  If try again you but with 'The VALUE NONE ROLE' in the session before the call, you will again have the question.

    Conclusion: If you need to do the action, you must grant the user the necessary privilege directly.

    Best regards

    Bruno Vroman.

  • procedure in the procedure

    Hello

    can we call the same procedure within the procedure?
    or parcel?
    -- Procedures.
    CREATE OR REPLACE PROCEDURE P1 IS
    BEGIN
    NULL;
    END;
    
    PROCEDURE P1 Compiled.
    ------------------------------------
    CREATE OR REPLACE PROCEDURE P2 IS
    BEGIN
    NULL;
    P1;
    END;
    
    PROCEDURE P2 Compiled.
    ------------------------------------
    --now replacing procedure P1
    CREATE OR REPLACE PROCEDURE P1 IS
    BEGIN
    NULL;
    P2;
    END;
    
    PROCEDURE P1 Compiled.
    ------------------------------------
    --  now again compile P1 procedure, will get error.
    CREATE OR REPLACE PROCEDURE P1 IS
    BEGIN
    NULL;
    P2;
    END;
    Warning: execution completed with warning
    PROCEDURE P1 Compiled.
    
    -- Packages
    CREATE OR REPLACE PACKAGE PCK IS
    PROCEDURE P1;
    PROCEDURE P2;
    END;
    /
    CREATE OR REPLACE PACKAGE BODY PCK IS
    
    PROCEDURE P1 AS
    BEGIN
    P2;
    END;
    PROCEDURE P2 AS
    BEGIN
    P1;
    END;
    
    BEGIN
    P1;
    P2;
    END;
    
  • Dynamic PAT on the PIX

    Hi Expert,

    If I want the range of dynamic ports NAT in 5500 to 5800, in my address public IP that a NAT IP address private, how to set up?

    Here is an example,

    public IP = x.x.x.x

    address private IP = z.z.z.z

    NAT x.x.x.x port 5500-5800 to z.z.z.z port 5500-5800

    The PIX firewall running OS 6.3 (4).

    Customer actually needs to activate it for ftp trffic which allow customers can dynamic port within the range of 5500 and 5800.

    Hope someone can help me on this, thank you.

    Rgds,

    To the Shaw feel Yeong

    I checked your configs... the only option you have is of static type using 219.95.73.28 which is not yet used.

    public static 219.95.73.28 (inside, outside) 200.1.1.X netmask 255.255.255.255

    access-list 101 permit tcp any host 219.95.73.28 range 5500-5800

    I also see that remotely using remote desktop access from the Internet. Make your customer aware that this kind of access are a risk of security as user names and passwords travel on clear text. I suggest remote VPN set up for remote access. Anyway... the instructions above will solve your current problem.

    Please rate if you find it useful

  • migration package to the procedure, how to use THE params

    Hi all
    We just roll back packages in the stand alone procedures and I starat have problems with syntax and OUT defintion, for example our body of package/East:
    create or replace
    PACKAGE          PACK_RYBA_INVENT AS 
      TYPE CURSOR_INFO IS REF CURSOR;
      -- FUNCTION DECLARATIONS
      PROCEDURE p_RYBA_GetALL (in_custom IN NUMBER, out_cursorINFO OUT CURSOR_INFO);
    END PACK_RYBA_INVENT;
    
    -- body
    create or replace
    PACKAGE BODY                   PACK_RYBA_INVENT AS
      PROCEDURE p_RYBA_GetALL (in_custom IN NUMBER, out_cursorINFO OUT CURSOR_INFO) AS
        BEGIN
          OPEN out_cursorINFO FOR
          SELECT id_comp, id_name, cust_profile   FROM tc_INFO
          WHERE id_comp = in_custom;
        END p_RYBA_GetALL;
    END PACK_RYBA_INVENT;
    It is sweet to cursor declataion, specify us its type in code 'run '.
    I'm still new to Oracle, and I have the problem with the compilation of my inside, do not know how to correctly, report Cursro or should I let its declation in Packge and referencing it from there? How better to give this slider out all statements within the procedure, what Miss me? and I want to use the 'Cursor OPEN FOR' approach if possible.
    create or replace  Procedure  p_RYBA_GetALL (in_custom IN NUMBER,  out_cursorINFO OUT CURSOR_INFO) AS
     TYPE CT IS REF CURSOR RETURN tc_INFO.id_comp%TYPE, tc_INFO.id_name%TYPE , tc_INFO.cust_profile%TYPE;
     CURSOR_INFO CT;
       BEGIN
          OPEN out_cursorINFO FOR
          SELECT id_comp, id_name, cust_profile   FROM tc_INFO
          WHERE id_comp = in_custom;
        END ;
    TX
    TR

    Published by: trento on September 21, 2010 14:25

    sys_refcursor is available on 9i, here is the sample code that I tried...

    create or replace procedure getAllHierarchies (oc_sysrc out sys_refcursor)
    IS
    BEGIN
     OPEN oc_sysrc FOR SELECT * FROM tstproduct;
    EXCEPTION WHEN OTHERS THEN
       RAISE_APPLICATION_ERROR(-20002,SQLERRM);
    END getAllHierarchies;
    

    Then the procedure is called in this way...

    DECLARE
      refCursorValue SYS_REFCURSOR;
      myRecord tstproduct%ROWTYPE;
    BEGIN
      getAllHierarchies(refCursorValue);
    
      LOOP
        FETCH refCursorValue INTO myRecord;
        EXIT WHEN refCursorValue%NOTFOUND;
        dbms_output.put_line(TO_CHAR(myRecord.product_id)||' '||myRecord.product_description);
      END LOOP;
    EXCEPTION WHEN OTHERS THEN
      dbms_output.put_line(TO_CHAR(SQLCODE)||' '||SQLERRM);
    END;
    

Maybe you are looking for