execute the block via file sql plsql

Hi all

I'm trying to run under plsql block by putting in a sql file and run it as (-oradb/BDC/oracle/OracleHomes/db/111/bin/sqlplus cpa@bdcd/cpa @/ apps/bkrdlr/interface_programs/IDSI_apply_rec_H_apply_test.sql--) but for some reason his hanging in there any idea what I'm doing wrong here. These sql statements are run very well when I run by physically logging in. appreciate your help. Thank you
set serveroutput on;
DECLARE
x NUMBER(10):=0;
BEGIN
DBMS_OUTPUT.PUT_LINE('Loading A0 Records');
x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_A0;
DBMS_OUTPUT.PUT_LINE('total records fetched from A0: ' || x);

DBMS_OUTPUT.PUT_LINE('Loading D1 Records');
x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_D1;
DBMS_OUTPUT.PUT_LINE('total records fetched from D1: ' || x);

DBMS_OUTPUT.PUT_LINE('Loading D2 Records');
x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_D2;
DBMS_OUTPUT.PUT_LINE('total records fetched from D2: ' || x);

DBMS_OUTPUT.PUT_LINE('Loading B0 Records');
x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_B0;
DBMS_OUTPUT.PUT_LINE('total records fetched from B0: ' || x);

DBMS_OUTPUT.PUT_LINE('Loading B2 Records');
x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_B2;
DBMS_OUTPUT.PUT_LINE('total records fetched from B2: ' || x);

DBMS_OUTPUT.PUT_LINE('Loading M0 Records');
x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_M0;
DBMS_OUTPUT.PUT_LINE('total records fetched from M0: ' || x);

DBMS_OUTPUT.PUT_LINE('Loading M2 Records');
x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_M2;
DBMS_OUTPUT.PUT_LINE('total records fetched from M2: ' || x);
END;
commit;
exit
Hanging out:
$ /oradb/BDC/oracle/OracleHomes/db/111/bin/sqlplus cpa@bdcd/cpa @/apps/bkrdlr/interface_programs/IDSI_apply_rec_H_apply_test.sql

SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar 7 10:48:41 2011

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

 34
expected results (ran the connection manually)
SQL> /
Loading A0 Records
total records fetched from A0: 4253
Loading D1 Records
total records fetched from D1: 4253
Loading D2 Records
total records fetched from D2: 4253
Loading B0 Records
total records fetched from B0: 2853
Loading B2 Records
total records fetched from B2: 2799
Loading M0 Records
total records fetched from M0: 0
Loading M2 Records
total records fetched from M2: 96

PL/SQL procedure successfully completed.

Try to make / issue;

Tags: Database

Similar Questions

  • Hi, I am not able to execute the procedure using dblink in PLSql block. Although he works outside the end of the beginning. Please suggest solution

    Hello

    I'm not able to execute the procedure using dblink in PLSql block.

    Although he works outside the end of the beginning.

    Please suggest solution

    Hello

    Thanks everone for your contributions,

    As well as the permissions, I used to run inside the PL sql block, which was not necessary, we can simply call the procedure using dblink.

    Thanks guys,.

  • ORA-19510: unable to set the size of the blocks of file ' ' (blocksize =)

    I checked archivelog dest everything ok, power logs archived bit time, everything ok, I wondered what could cause this and how to solve this problem permanently.


    Log queue alerts
    Fri Jul 31 06:10:08 2009
    Errors in the /oracle/admin/gdwp/bdump/gdwp_arc0_1220702.trc file:
    ORA-19510: unable to set the size of the blocks of 74905 for the file ' / archive/gdwp/gdwp_1_18207_654896926.arc ' (blocksize = 512)
    ORA-27037: unable to get file status
    IBM AIX RISC System/6000 error: 2: no such file or directory
    Additional information: 9
    Fri Jul 31 06:10:08 2009
    Errors in the /oracle/admin/gdwp/bdump/gdwp_arc0_1220702.trc file:
    ORA-19510: unable to set the size of the blocks of 74905 for the file ' / archive/gdwp/gdwp_1_18207_654896926.arc ' (blocksize = 512)
    ORA-27037: unable to get file status
    IBM AIX RISC System/6000 error: 2: no such file or directory
    Additional information: 9
    Fri Jul 31 06:10:08 2009
    Arc0: Error 19510 closing log file archive ' / archive/gdwp/gdwp_1_18207_654896926.arc'
    ARCH: Stopped archiving, error occurred. Will continue to retry
    Fri Jul 31 06:10:08 2009
    ORACLE Instance gdwp - archive error
    Fri Jul 31 06:10:08 2009
    ORA-16038: log 1 # 18207 sequence can be archived
    ORA-19510: unable to set the size of the blocks of file ' ' (blocksize =)
    ORA-00312: thread 1 1 online journal: ' / db01/oradata/gdwp/redo01.log'
    Fri Jul 31 06:10:08 2009
    Errors in the /oracle/admin/gdwp/bdump/gdwp_arc0_1220702.trc file:
    ORA-16038: log 1 # 18207 sequence can be archived
    ORA-19510: unable to set the size of the blocks of file ' ' (blocksize =)
    ORA-00312: thread 1 1 online journal: ' / db01/oradata/gdwp/redo01.log'
    Fri Jul 31 06:10:11 2009
    ARCH: Stopped archiving, error occurred. Will continue to retry
    Fri Jul 31 06:10:11 2009
    ORACLE Instance gdwp - archive error
    Fri Jul 31 06:10:11 2009
    ORA-16014: log 1 sequence # 18207 not archived, no available destinations

    DBA2008 wrote:
    Notes 560204.1 suggest that to get rid of the generation of the trace file, is - it safe?

    I won't read the note at the moment but would surely say they told you to check the destination where the files are current. Did you do that? Raise a SR with OSS, to get their approval before doing something like what you try. Its you only who would face consequences, good or bad, no one else so better take a safe approach and the first approval of OSS.

    HTH
    Aman...

  • Make the HTML via PL/SQL code

    How can I get a file via PL/SQL porgram .html.

    You can use TEXT_IO built - in the opening and drop package
    and use the HTML tag
    and tag/html to open and station as

    declare
    sFile text_io.file_type;
    Start
    sFile:=TEXT_IO.fopen('D:\ss\ss','rw");
    TEXT_IO.put_line (sFile, e');
    TEXT_IO.put_line (sfile, '<-------------->');
    TEXT_IO.put_line (sFile, e');
    end;

  • Call the file sql plsql

    Hello
    I'm stuck for several days in this issue. Hope someone help me.

    I'm using Oracle 11.

    I am writing a utility to purge the data from the database based on certain criteria.
    We do not have physical (actual) the partitions present on our system (since we do not use Enterprise edition).
    We have 57 paintings representing 57 partitions. Then, we create a view of all of these 57 tables-

    CREATE or REPLACE VIEW MY_VIEW AS
    Select [column_names] from table1
    UNION ALL
    Select [column_names] in table2
    UNION ALL
    Select [column_names] in table 3
    UNION ALL
    :
    :
    :
    Select [column_names] of table57
    ;

    This superior query is saved in the 'body' of user_views.

    Now when a user wants to delete a partition-
    -I read the body of the request in the .sql file.
    -Edit the .sql file that is, remove the unwanted ' select * from many '
    -Loss of vision.
    -Recreate the view from the edited .sql file.


    The question is in the creation of the view on the fly of the procedure-
    -I'm not EXECUTE IMMEDIATE 'CREATE VIEW... ' and ' DBMS_SQL. PARSE' the request body exceeds 32,767 characters.


    So I chose the option of filing to write. In the file, I write the query VIEW and then I want to create the view from this file.

    Now, I'm not able to call the .sql that contains
    CREATE OR REPLACE VIEW MYVIEW AS
    Select...
    UNION ALL
    Select...
    :
    :
    Select...

    Length of character of this file is about 90000.



    Please guide me in this issue.
    Any new idea to manage very large display in the long term is also welcome...


    Thanks in advance
    Micheline
    ARGE view at run time is also welcome...


    Thanks in advance
    Micheline

    When you use DBMS_SQL, the declaration must not end with a semicolon, or you will get ora - 911.

    ---------
    Sybrand Bakker
    Senior Oracle DBA

  • How can I access the new site files I created in Adobe Muse?

    To publish on my own Web site hosting server?  Thank you.

    You can export the site via file-> export as HTML. More about it here - http://www.adobekb.com/getting_started_07.html#exportinghtml.

    You can even post to your host via the integrated FTP - http://www.adobekb.com/launching_pt02.html#publishingsiteto3party.

    Thank you

    Vinayak

  • Execute Javascript via PL/SQL

    Hello

    I'm trying to run a simple js in plsql exactly as in the link here, but I don't know where I'm going wrong it does not work for me, doing exactly the same thing by putting the code in DA plsql type and running when you click the button.

    Denes Kubicek ApEx BLOG: Run Javascript via PL/SQL

    where iam going bad? the alert doesn't popup but ik fixed all syntax errors

    what I did:

    ================================

    create DA on click the button, and then set it to run when the page loads

    Code:

    v_todayVARCHAR2 (200);

    v_emp_count NUMBER;

    BEGIN

    SELECT COUNT (*)

    IN v_emp_count
    EMP;

    because loop me in 1.10

    v_today: = TO_CHAR (SYSDATE, "dd.mm.yyyy hh24:mi:ss");

    HTP.p ("< script type =" text/javascript"> '");

    HTP.p (' alert (""is today"))

    || I have | » '|| v_today
    || '.\n'
    || "He must."
    || v_emp_count
    || ' employees in your emp table. \n"
    || "This is an alert generated by a PL/SQL block \n".
    || "(l'exécution de code javascript!'');" );
    END loop;

    HTP.p ("< /script >");

    end;

    any help?

    concerning

    Hello

    Gor_Mahia wrote:

    you're right, I know / 3.2, we had no DA, but if I run it as a plsql code type DA or plsql process page it should work I don't see that as a problem in this case, no?

    Dene example idea is JavaScript print while the page is loading. Then he will be executed.

    When you print out the script tag after the page is rendered using the DA, it won't work not and not executed. That's how work browsers.

    You should also read the comments of this blog post from Dene.

    What iam trying to do is nothing special, just trying to execute this code example as it is?

    You try to simply approach quite wrong.

    Kind regards

    Jari

  • pass the parameter in pl/sql block

    Hello

    I have to call anonymous pl/block block with the shell script parameter. It works fine as indicated below, the problem is - generated email after the creation of the table in step contains
    list of all directories and files, instead of "select * from". When I change * to the values of columns, everything works well, but I need to use ' * ' in select statement.
    Please let me know which remedy.
    set serveroutput on
    @${CREATE_STAGE_SQL} ${i}
    COMMIT;
    QUIT;
    EOF
    CREATE_STAGE_SQL. SQL
    declare
    begin
    ### some other processing###
     execute immediate 'create table T1_&1._STG as select * from t1_rpt_tmt where 1=2';
    end 
     
    Thank you
    Sandy

    Sandy310 wrote:

    Question - how to select * on my application, how to use * (special character) bulk pl/sql call?
    I used & 1. (dot) to pass parameter.

    Example:

    // the script
    /home/billy/sql> cat show-employees.sql
    --// usage: show-employees.sql 
    --//
    --// where:     sql-projection = comma delimited column list
    
    set verify off
    set define on
    define PROJECTION=&1
    
    select &PROJECTION from emp order by 1;
    
    exit
    
    // running script for single column
    /home/billy/sql> sqlplus scott/tiger @show-employees.sql ename
    
    SQL*Plus: Release 11.2.0.2.0 Production on Thu Apr 18 08:01:10 2013
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
    OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
    
    ENAME
    ----------
    ADAMS
    ALLEN
    BLAKE
    CLARK
    FORD
    JAMES
    JONES
    KING
    MARTIN
    MILLER
    SCOTT
    SMITH
    TURNER
    WARD
    
    14 rows selected.
    
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
    OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
    
    // running script for all columns using asterisk - and to prevent bash from processing
    // the asterisk as a file/dir listing parameter, we escape the character using a slash
    /home/billy/sql> sqlplus scott/tiger @show-employees.sql \*
    
    SQL*Plus: Release 11.2.0.2.0 Production on Thu Apr 18 08:01:17 2013
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
    OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
    
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
    ---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
          7369 SMITH      CLERK           7902 1980/12/17 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 1981/02/20 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 1981/02/22 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 1981/04/02 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 1981/09/28 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 1981/05/01 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 1981/06/09 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 1987/04/19 00:00:00       3000                    20
          7839 KING       PRESIDENT            1981/11/17 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 1981/09/08 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 1987/05/23 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 1981/12/03 00:00:00        950                    30
          7902 FORD       ANALYST         7566 1981/12/03 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 1982/01/23 00:00:00       1300                    10
    
    14 rows selected.
    
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
    OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
    
  • Is it possible to call a file sql in a pl/sql block

    Hello

    I want to call a file sql in a pl/sql block.

    the pl/sql block has an exception handler. The pl/sql block runs the sql file and where it throws error then the exception handler will take care of it.

    The sql file will be a master file and he will himself call other sql files.

    is it possible to call any pl/sql block sql file?

    When you say "sql file", what exactly do you mean? You have a file that has just SQL statements? Or you have SQL * more scripts?
    Where are the files stored? They are on your client machine? Or the database server?

    "that in turn calls the other sql files ' seems to imply that the answer to the first question is that you have SQL * scripts more. If you have SQL * more scripts, you need SQL * more to execute. PL/SQL runs in the database Oracle, SQL * more is a client application. It is not practical to have the PL/SQL call SQL * more. Since you have already excluded from the best of bad options, it seems that the answer is no, you cannot have your PL/SQL, run these files.

    As Alex, it's probably a good thing. It seems that your application has been designed incorrectly. If you need PL/SQL, you must be to create stored procedures and functions, and calling those of PL/SQL. Have the PL/SQL depend on the code in flat files outside the database is not a good idea.

    Justin

  • How to block the registration of files with a windows xp-specific extension

    How to block the registration of files in windows xp with a specific extension, example the user cannot save a file with the extension exe or mp3 or another, as management on the filtering of files, windows 2003 server, I can't find the steps for the blocking process I mean in windows xp prof

    Windows cannot do natively.  A file name is simply a file name and you can not prevent the registration of a file based on its extension.

    You can change file associations, such as a double click on a file with a particular extension will not automatically launch an application given, however, but that's not what you asked.
    You may also schedule a program to run from time to time which will erase all files with a given as well.  but until this program is executed, such a file might exist on your disk.

    HTH,
    JW

  • XML data in the table using sql/plsql

    Hi experts,

    Could you please help with the following requirement. I have the tags xml (.xml on a server file) below. I need to access this file and read the XML and insert into the db table using sql and plsql. Is it possible with the cdata below? And there is a nested this table.

    Could someone please guide me if you have a sample code file and xml.

    <? XML version = "1.0" encoding = "UTF-8"? >

    < generation_date > <! [CDATA [17/11/2015]] > < / generation_date >

    < generated_by > <! [CDATA [Admin Admin]] > < / generated_by >

    < year > <! [CDATA [2015]] > < / year >

    < month > <! [CDATA [01]] > < / month >

    < author >

    < author > <! [CDATA [user author]] > < / author > < author_initial > <! [CDATA [user]] > < / author_firstname > < author_country > <! [CDATA [author]] > < / author_lastname >

    < author_email > <! [CDATA [[email protected]]] > < / author_email >

    < author_data_01 > <! [CDATA []] > < / author_data_01 >

    < author_data_02 > <! [CDATA []] > < / author_data_02 >

    < items >

    < article_item >

    < article_id > <! [CDATA [123456]] > < / article_id >

    < publication > <! [CDATA [Al Bayan]] > < / publication >

    < section > <! [CDATA [Local]] > < / section >

    < issue_date > <! [CDATA [11/11/2015]] > < / issue_date >

    < page > <! [CDATA [2]] > < / print this page >

    < article_title > <! [CDATA [title.]] > < / article_title > < number_of_words > <! [CDATA [165]] > < / number_of_words >

    < original_price > <! [CDATA [200]] > < / original_price >

    < original_price_currency > <! [CDATA [DEA]] > < / original_price_currency >

    < price > <! [CDATA [250]] > < / price >

    < price_currency > <! [CDATA [DEA]] > < / price_currency >

    < / article_item >

    < / articles >

    < total_amount > <! [CDATA [250]] > < / total_amount >

    < total_amount_currency > <! [CDATA [DEA]] > < / total_amount_currency >

    < / author >

    < / xml >

    Thanks in advance,

    Suman

    XMLTABLE using...

    SQL > ed
    A written file afiedt.buf

    1 with t (xml) as (select xmltype ('))
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    [[12 [email protected]]] >
    13
    14
    15
    16
    17
    18
    19


    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33 ") of the double)"
    34-

    35 end of sample data
    36-
    37 - assumptions:
    (38 - a) XML may have several tags
    (39 - b) each may contain more
    40-
    41 select x.gen_by, x.gen_date, x.mn, x.yr
    42, y.author, y.auth_fn, y.auth_ln, y.auth_cnt, y.auth_em, y.auth_d1, y.auth_d2

    43, z.id, z.pub, z.sec, z.iss_dt, z.pg, z.art_ttl, z.num_wrds, z.oprice, z.ocurr, z.price, z.curr
    44 t
    45, xmltable ('/ authxml')
    from $ 46 t.xml
    path of 47 columns gen_date varchar2 (10) '. / generation_date'
    48, path of varchar2 (15) of gen_by '. / generated_by'
    49, path of varchar2 (4) year '. "/ year"
    50 varchar2 (2) mn road '. "/ month"
    51, path of xmltype authors '.'
    52                 ) x
    53, xmltable ('/ authxml/authors ')
    from $ 54 x.authors
    author of 55 path of varchar2 columns (15) '. / author'
    56, path of varchar2 (10) of auth_fn '. / author_firstname'
    57, path of varchar2 (10) of auth_ln '. / author_lastname'
    58 road of VARCHAR2 (3) auth_cnt '. / author_country'
    59 road of varchar2 (20) of auth_em '. / author_email'
    60 road of varchar2 (5) of auth_d1 '. / author_data_01'
    61, path of varchar2 (5) of auth_d2 '. / author_data_02'
    62, path of xmltype articles '. / Articles'
    63                 ) y
    64, xmltable ('/ Articles/article_item ')
    from $ 65 y.articles
    path id 66 number columns '. / article_id'
    67, path of varchar2 (10) pub '. ' / publication.
    68 road of varchar2 (10) dry '. / section'
    69, path of varchar2 (10) of iss_dt '. / issue_date'
    70 road of VARCHAR2 (3) pg '. "/ print this page"
    71, path of varchar2 (20) of art_ttl '. / article_title'
    72, path of varchar2 (5) of num_wrds '. / number_of_words'
    73, path of varchar2 (5) of oprice '. / original_price'
    74 road to VARCHAR2 (3) ocurr '. / original_price_currency'
    75, path of varchar2 (5) price '. "/ price"
    76, path of VARCHAR2 (3) curr '. / price_currency'
    77*                ) z
    SQL > /.

    GEN_DATE GEN_BY YEAR MN AUTHOR AUTH_FN AUTH_LN AUT AUTH_EM AUTH_ AUTH_ ID PUB DRY ISS_DT PG ART_TTL NUM_W OPRIC HEARTS PRICE OCU
    ---------- --------------- ---- -- --------------- ---------- ---------- --- -------------------- ----- ----- ---------- ---------- ---------- ---------- --- -------------------- ----- ----- --- ----- ---
    17/11/2015 Admin Admin 2015 01 user author user author [email protected] 123456 UAE Al Bayan Local 11/11/2015 2 is the title.   165 200 AED AED 250

    Of course, you'll want to change the types of data, etc. as needed.

    I assumed that the XML can contain several "" sections and that each section can contain several entries.

    Thus the XMLTABLE aliasing as 'x' gives information of XML, and supplies the data associated with the XMLTABLE with alias 'y' which gets the multiple authors, which itself section of the XMLTABLE with alias 'z' for each of the article_item.

    CDATA stuff are handled automatically by SQLX (XML functionality integrated into Oracle's SQL)

  • SQL * sequential data Loader in the treatment Record file?

    If I use the will of classic way SQL * Loader process a data file in the order from top to bottom?  I have a file with header and the detail records without value found in the detail records that can be used to connect to the header records.  The only option is to derive a header value via a sequence (nextval) and then fill in the detail records with the same value from the same sequence (currval).  But to do SQL * Loader should treat the file in the exact order that the data has been written to the data file.  I read through the 11 g Oracle® database utilities SQL * Loader sections looking for evidence that this is what's going to happen, but have not found this information and I don't want to assume that SQL * Loader will always process the data file records in order.

    Thank you

    Support of Oracle responded with the following statement.

    "Yes, SQL * LOADER file data from top down process."
    This has been affected in the note below:

    "SQL * Loader - how to load a single logical record physical records line breaks include (Doc ID 160093.1).

    Jason

  • execute the dynamic sql statement

    Hi all

    CREATE TABLE  XX_OFFICE_USER_IMP 
      (
        ID              NUMBER,
        OFFICE          VARCHAR2(10 BYTE),
        USER_NAME       VARCHAR2(10 BYTE),
        BANK_ACCOUNT_ID NUMBER,
        TRANSFERED      NUMBER
      )
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (421,'0000','F0000',10029,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (422,'0000','F0000',10031,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (423,'0000','F0000',10033,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (424,'0000','F0000',10036,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (425,'0000','F0000',10037,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (426,'0000','F0000',10039,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (427,'0000','F0000',10041,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (428,'0000','F0000',10046,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (429,'0000','F0000',10048,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (430,'0000','F0000',10067,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (431,'0000','F0000',10072,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (432,'0000','F0000',10087,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (433,'0000','F0000',10092,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (434,'0000','F0000',10008,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (435,'0000','F0000',10012,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (436,'0000','F0000',10013,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (437,'0000','F0000',10014,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (438,'0000','F0000',10017,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (439,'0000','F0000',10019,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (440,'0000','F0000',10024,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (441,'0000','F0000',10025,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (442,'0000','F0000',10001,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (443,'0000','F0000',10002,null);
    CREATE TABLE XXBG_CASIER_CASH
      (
        CASHIER         VARCHAR2(32 BYTE),
        BANK_ACCOUNT_ID NUMBER(38,0)
      )
    declare 
    v_exe_grant varchar2(32767 char);
    begin 
    
    
    for i in (select * from xx_office_user_imp where office = '0000') loop
    
      insert into XXBG_CASIER_CASH values (i.user_name, i.bank_account_id);
    
      v_exe_grant := 
                     'create user '  || i.user_name || ' identified by ' || i.user_name || ';' 
                  || 'GRANT create session to ' || i.user_name || ';' 
                  || 'GRANT select on apps.XXBG_CE_STATEMENT_HEADERS_CASH to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.FND_USER TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.dFND_DESCR_FLEX_COL_USAGE_TL TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.fnd_descr_flex_column_usages to ' || i.user_name || ';' 
                  || 'GRANT select on apps.fnd_descriptive_flexs to ' || i.user_name || ';' 
                  || 'GRANT select on apps.fnd_descriptive_flexs_tl to ' || i.user_name || ';' 
                  || 'GRANT select on ce.ce_statement_headers to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.fnd_doc_sequence_assignments TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON CE.CE_STATEMENT_HEADERS_S TO ' || i.user_name || ';' 
                  || 'GRANT EXECUTE ON APPS.XXBG_GET_NEXTVAL TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON CE.CE_STATEMENT_LINES TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.XXBG_CE_STATEMENT_LINES TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.CE_BANK_ACCOUNTS to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.CE_BANK_BRANCHES_V TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON CE.XXBG_CASIER_CASH TO ' || i.user_name || ';' 
                  || 'GRANT EXECUTE ON APPS.XXBG_ST TO ' || i.user_name || ';' 
                  || 'GRANT select on ce.xxbg_ce_statement_lines_detail to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.ce_transaction_codes TO ' || i.user_name || ';' 
                  || 'GRANT select on ce.ce_statement_lines_s to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON CE.XXBG_CE_STATEMENT_LINES_DET_SQ TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.xx_pko_lines to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON apps.xx_rko_lines TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.XX_INVOICE_RELATIONS_CASH to ' || i.user_name || ';' 
                  || 'GRANT select on APPS.PO_VENDOR_SITES_ALL to ' || i.user_name || ';' 
                  || 'GRANT select on ap.AP_INVOICE_LINES_INTERFACE_S to ' || i.user_name || ';' 
                  || 'GRANT select on ap.AP_INVOICE_LINES_INTERFACE to ' || i.user_name || ';' 
                  || 'GRANT select on APPS.ap_distribution_set_lines_all to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_INVOICES_INTERFACE_S TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_INVOICES_INTERFACE TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_DISTRIBUTION_SETS_ALL  TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.ce_lookups  to ' || i.user_name || ';' 
                  || 'GRANT select on ar.HZ_CUST_SITE_USES_ALL to ' || i.user_name || ';' 
                  || 'GRANT select on ar.HZ_LOCATIONS to ' || i.user_name || ';' 
                  || 'GRANT select on ar.HZ_PARTIES to ' || i.user_name || ';' 
                  || 'GRANT select on ar.HZ_PARTY_SITES to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON AR.HZ_CUST_ACCT_SITES_ALL TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON AR.HZ_CUST_ACCOUNTS TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.XXBG_CLAIMS_V TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.xxbg_insis_agents_v to ' || i.user_name || ';' 
                  || 'GRANT select on ce.xxbg_cash_doc_types to ' || i.user_name || ';' 
                  || 'GRANT select on AP.AP_BANK_ACCOUNTS_ALL to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON AP.AP_BANK_BRANCHES TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.FND_DESCR_FLEX_CONTEXTS TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.FND_DESCR_FLEX_CONTEXTS_TL TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_SUPPLIERS to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.per_employees_x TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.fnd_doc_seq_categories_ap_v TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_LC_INVOICE_TYPES_V to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON ce.xxbg_ce_statement_lines_sq to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.XXBG_STATEMENT_HEADERS_CASH to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.XXBG_INSIS_POLICY_V TO ' || i.user_name || ';' 
                  || 'GRANT insert  ON ce.ce_statement_lines to ' || i.user_name || ';' 
                  || 'GRANT INSERT  ON CE.XXBG_CE_STATEMENT_LINES_DETAIL TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON APPS.AP_INVOICES_INTERFACE TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON APPS.AP_INVOICE_LINES_INTERFACE TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON APPS.XX_RKO_LINES TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON APPS.XX_PKO_LINES TO ' || i.user_name || ';' 
                  || 'GRANT delete on ce.xxbg_ce_statement_lines_detail to ' || i.user_name || ';' 
                  || 'GRANT update on ce.XXBG_CE_STATEMENT_LINES_DETAIL to ' || i.user_name || ';' 
                  || 'GRANT DELETE ON CE.CE_STATEMENT_LINES TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON CE.CE_STATEMENT_HEADERS TO ' || i.user_name || ';' 
                  || 'GRANT update on CE.CE_STATEMENT_HEADERS to ' || i.user_name || ';' 
                  || 'GRANT update on ce.CE_STATEMENT_LINES to ' || i.user_name || ';' 
                  || 'GRANT select on apps.XX_AGENTS_NO_V to ' || i.user_name || ';' ;
                  
                  
      execute immediate v_exe_grant;
      
    update xx_office_user_imp
      set transfered = 1 
      where id = i.id
    ;
    
    v_exe_grant := '';
    end loop;
    
    end;
    /
    After execute the PL/SQL block I get the message:
    Error report:
    ORA-00911: invalid character
    ORA-06512: at line 79
    00911. 00000 -  "invalid character"
    *Cause:    identifiers may not start with any ASCII character other than
               letters and numbers.  $#_ are also allowed after the first
               character.  Identifiers enclosed by doublequotes may contain
               any character other than a doublequote.  Alternative quotes
               (q'#...#') cannot use spaces, tabs, or carriage returns as
               delimiters.  For all other contexts, consult the SQL Language
               Reference Manual.
    *Action:
    Any ideas? I think I call correct immediate execution.

    DB version: 11g

    Unfortunately I can't provide you the sql code of the other tables to create their... Maybe you should try without all budgets... :)


    Thanks in advance,
    Bahchevanov.

    Edited by: bahchevanov on 11 October 2012 06:14

    Bahchevanov wrote:
    Any ideas?

    Sure. EXECUTE IMMEDIATE executes a unique statement when you try to run the job. So use:

    execute immediate 'create user '  || i.user_name || ' identified by ' || i.user_name;
    execute immediate 'GRANT create session to ' || i.user_name;
    execute immediate 'GRANT select on apps.XXBG_CE_STATEMENT_HEADERS_CASH to ' || i.user_name;
    .
    .
    .
    

    SY.

  • How to execute the pl/sql shell script

    Hi Experts


    I need to be able to call a pl/sql procedure shell script

    Linux and 11g

    I am new to java and followed the solution below
    The appeal of OS in Plsql commands

    After following the solution on top of link

    Declare
    x Varchar2 (2000);
    Begin
    x: = OSCommand_Run ('ls - the);
    -print x;
    DBMS_OUTPUT. Put_line (x);
    End;
    /

    give me output of 0 but the command is not executed.

    What must be changed or is there another solution?

    Thank you
    Archana

    See if that helps...

    [http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php]

  • Blocker withdraws the deadlock trace file (self)

    Hello

    Recently, I had a problem on a 10.2.0.4 database to single instance where blockages are produced. The following test case reproduced the problem (I create three tables parent, a child table with foreign keys indexed to all parents three tables and a procedure that performs an insert in the child table in a standalone transaction):
    create table parent_1(id number primary key);
    
    create table parent_2(id number primary key);
    
    create table parent_3(id number primary key);
     
    create table child( id_c number primary key,
                       id_p1 number,
                       id_p2 number,
                       id_p3 number,
                       constraint fk_id_p1 foreign key (id_p1) references parent_1(id),
                       constraint fk_id_p2 foreign key (id_p2) references parent_2(id),
                       constraint fk_id_p3 foreign key (id_p3) references parent_3(id)
                       );
     
    create index i_id_p1 on child(id_p1);
    
    create index i_id_p2 on child(id_p2);
    
    create index i_id_p3 on child(id_p3);
    
    create or replace procedure insert_into_child as
    pragma autonomous_transaction;
    begin
      insert into child(id_c, id_p1, id_p2, id_p3) values(1,1,1,1);
      commit;
    end;
    /
     
    insert into parent_1 values(1);
    
    insert into parent_2 values(1);
    
    commit;
    And now the action that causes the deadlock:
    SQL> insert into parent_3 values(1);
    
    1 row created.
    
    SQL> exec insert_into_child;
    BEGIN insert_into_child; END;
    
    *
    ERROR at line 1:
    ORA-00060: deadlock detected while waiting for resource
    ORA-06512: at "SCOTT.INSERT_INTO_CHILD", line 4
    ORA-06512: at line 1
    My question is: How can I determine which integration into the CHILD table waiting for? He could wait on a combination of these, PARENT_3, PARENT_2, PARENT_1, or even on the CHILD if I tried to insert a primary key that is duplicated in the CHILD. Since we have the full test case, we know that he was waiting on PARENT_3 (or better said, he expected to perform a commit / rollback of the transaction 'parent'), but is it possible to determine that only from the deadlock trace file? I ask that because to identify the problem, I had to perform redo log mining, tracing pl/sql with DBMS_TRACE and manual debugging on a clone of the production database that has been restored to a SNA just before blocking is product. So, I had to do a lot of work to get to the trainer table and if this information is already in the deadlock trace file, it would have saved me a lot of time.

    Here is the deadlock trace file. In section "DML LOCK", I assumed that the child table (tab = 227042) holds a 3 way locks (SX), all other tables of three parents have a mode 2 locks (SS), but from this excerpt, I see that parent_3 (tab = 227040) blocks the children insert:
    Deadlock graph:
                           ---------Blocker(s)--------  ---------Waiter(s)---------
    Resource Name          process session holds waits  process session holds waits
    TX-00070029-00749150        23     476     X             23     476           S
    session 476: DID 0001-0017-00000003     session 476: DID 0001-0017-00000003
    Rows waited on:
    Session 476: obj - rowid = 000376E2 - AAA3biAAEAAA4BwAAA
      (dictionary objn - 227042, file - 4, block - 229488, slot - 0)
    Information on the OTHER waiting sessions:
    End of information on OTHER waiting sessions.
    Current SQL statement for this session:
    INSERT INTO CHILD(ID_C, ID_P1, ID_P2, ID_P3) VALUES(1,1,1,1)
    ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    3989eef50         4  procedure SCOTT.INSERT_INTO_CHILD
    391f3d870         1  anonymous block
    .
    .
    .
    .
            SO: 397691978, type: 36, owner: 39686af98, flag: INIT/-/-/0x00
            DML LOCK: tab=227042 flg=11 chi=0
                      his[0]: mod=3 spn=35288
            (enqueue) TM-000376E2-00000000  DID: 0001-0017-00000003
            lv: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  res_flag: 0x6
            res: 0x398341fe8, mode: SX, lock_flag: 0x0
            own: 0x3980df420, sess: 0x3980df420, proc: 0x39859c660, prv: 0x398341ff8
            ----------------------------------------
            SO: 397691878, type: 36, owner: 39686af98, flag: INIT/-/-/0x00
            DML LOCK: tab=227040 flg=11 chi=0
                      his[0]: mod=2 spn=35288
            (enqueue) TM-000376E0-00000000  DID: 0001-0017-00000003
            lv: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  res_flag: 0x6
            res: 0x3983386e8, mode: SS, lock_flag: 0x0
            own: 0x3980df420, sess: 0x3980df420, proc: 0x39859c660, prv: 0x3983386f8
            ----------------------------------------
            SO: 397691778, type: 36, owner: 39686af98, flag: INIT/-/-/0x00
            DML LOCK: tab=227038 flg=11 chi=0
                      his[0]: mod=2 spn=35288
            (enqueue) TM-000376DE-00000000  DID: 0001-0017-00000003
            lv: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  res_flag: 0x6
            res: 0x398340f58, mode: SS, lock_flag: 0x0
            own: 0x3980df420, sess: 0x3980df420, proc: 0x39859c660, prv: 0x398340f68
            ----------------------------------------
            SO: 397691678, type: 36, owner: 39686af98, flag: INIT/-/-/0x00
            DML LOCK: tab=227036 flg=11 chi=0
                      his[0]: mod=2 spn=35288
            (enqueue) TM-000376DC-00000000  DID: 0001-0017-00000003
            lv: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  res_flag: 0x6
            res: 0x39833f358, mode: SS, lock_flag: 0x0
            own: 0x3980df420, sess: 0x3980df420, proc: 0x39859c660, prv: 0x39833f368
          ----------------------------------------
    Thanks in advance for your comments,
    Swear

    user633661 wrote:

    My question is: How can I determine which integration into the CHILD table waiting for? He could wait on a combination of these, PARENT_3, PARENT_2, PARENT_1, or even on the CHILD if I tried to insert a primary key that is duplicated in the CHILD. Since we have the full test case, we know that he was waiting on PARENT_3 (or better said, he expected to perform a commit / rollback of the transaction 'parent'), but is it possible to determine that only from the deadlock trace file?

    There is no way to get the answer from the deadlock trace.

    At this stage and with your example, the waiting session waits for a lock of the TX (transaction) - this means that he has no idea (and uninteresting) in the involved actual data, that it is simply waiting for a location of transaction undo segment header table clear.

    An easy way to demonstrate, it is as follows:-


    create the parent and child tables with the activated FK constraint
    Session 1 - set a save point, then insert line into parent but do not commit
    Session 2 - insert a load line in the child - the session will pass a waiting for TX lock on the parent transaction
    Session 1-restoration to the point of backup

    Because restoration is a save point, session 1 always held a TX lock in exclusive mode, even if it will take is more all lock TM (table).
    Session 2 will still wait for session 1 to commit or rollback - even if the parent required row does not exist, even in a State that is not validated.

    Concerning
    Jonathan Lewis
    http://jonathanlewis.WordPress.com
    Author: core Oracle

Maybe you are looking for