Problem in Procedure!!!

Hai,
I am having a procedure XYZ. It will take the 7 tables count and it will display it using DBMS_OUTPUT. Table counts are taken using cursors C-C6. And then procedure XYZ is executed thro' a unix script. In that i spool the log file.
The problem is if i execute the procedure directly, then it displays 7 tables record count without problem. If i execute the same procedure thro' unix script its displaying only 6 tables count. This problem is in PROD
If i execute the same procedure XYZ thro unix script in DEV, its displaying all the seven records.
I couldnt able to find wat went wrong on this. Pls help me on this.
Thanks!!!

So what is the difference between PROD and DEV? Only you can answer that. We do not have the requisite access. Obvious areas for investigation: does the missing table have any records in it? Does the missing table actually exist on the PROD database.
The teaching is, in the future ensure that your code is properly instrumented so you can switch on debug output even in production, to diagnose faults.
By the way ...
it will display it using DBMS_OUTPUT... And then procedure XYZ is executed
thro' a unix script. In that i spool the log file.Can I just say 'Ugh?' Has nobody heard of UTL_FILE?
Cheers, APC

Similar Messages

  • Problem with procedure in package

    Problem with procedure in package:
    create table accounts
    (acno number(10),
    name varchar2(20),
    balance number(10,2));
    create package banking is
    procedure new_acct(acno NUMBER, name IN VARCHAR);
    procedure acct_dep(acno IN NUMBER, amount IN NUMBER);
    procedure acc_wdr(acno IN NUMBER, amount IN NUMBER);
    procedure acc_bal(acno IN NUMBER, bal OUT NUMBER);
    function acc_drwn(acno IN NUMBER) RETURN BOOLEAN;
    end banking;
    create or replace package body banking is
    procedure new_acct ( acno IN number,
    name IN varchar) is
    begin
    insert into accounts
    (acno, name, balance)
    values
    (acno, name,0);
    end;
    procedure acct_dep(acno IN NUMBER,
    amount IN NUMBER) is
    begin
    update accounts
    set balance = balance + amount
    where acno = acno;
    end;
    procedure acc_wdr(acno IN NUMBER,
    amount IN NUMBER) is
    begin
    update accounts
    set balance = balance - amount
    where acno = acno;
    end;
    procedure acc_bal(acno IN NUMBER,
    bal OUT NUMBER) is
    begin
    declare cursor c_balance(i_acno IN accounts.acno%type) is
    select balance
    from accounts
    where acno = i_acno;
    acc_bal accounts.balance%type;
    begin
    if c_balance%isopen then
    close c_balance;
    end if;
    open c_balance(acno);
    fetch c_balance into acc_bal;
    close c_balance;
    end;
    end;
    function acc_drwn(acno IN NUMBER) RETURN BOOLEAN is
    begin
    declare cursor c_balance(i_acno IN accounts.acno%type) is
    select balance
    from accounts
    where acno = i_acno;
    bal accounts.balance%type;
    begin
    if c_balance%isopen then
    close c_balance;
    end if;
    open c_balance(acno);
    fetch c_balance into bal;
    close c_balance;
    if bal < 0 then
    return true;
    else
    return false;
    end if;
    end;
    end;
    end banking;
    begin
    banking.new_acct(123,'FRANKS');
    end;
    execute banking.acct_dep(123,100);
    execute banking.acc_wdr(123,50);
    Works fine up to this point, however when running the balance check the balance amount is not visible?
    SQL> set serveroutput on
    SQL> begin
    2 declare
    3 bal accounts.balance%type;
    4 begin
    5 banking.acc_bal(123,bal);
    6 dbms_output.put_line('Franks balance is '||bal);
    7 end;
    8 end;
    9 /

    procedure acc_bal(acno IN NUMBER,
       bal OUT NUMBER)
    is
    cursor c_balance(i_acno IN accounts.acno%type) is
       select balance
       from accounts
       where acno = i_acno;
       l_acc_bal accounts.balance%type;
    begin
       open c_balance(acno);
       fetch c_balance into l_acc_bal;
       close c_balance;
       bal := l_acc_bal;
    end;

  • Demantra - problem with procedure EP_BUILD_MODEL

    Hi,
    We have installed Demantra 7.3.1 Then create new model with Data Model Wizard. After clicking Build model we got the following error:
    Error - ORA-20001: Error in Procedure REBUILD_DATABASE ORA-1400: can not insert null in (DEAMANTRA.LOC_LEVELS.ENGINE_PROFILES_ID)
    I found out that reason of this problem is procedure Data_Model.rebuild_database
    Statements like this:
    INSERT INTO LOC_LEVELS (loc_level,loc_field_name,loc_field) VALUES (1,'Lowest Location Level',1);
    INSERT INTO LOC_LEVELS (loc_level,loc_field_name,loc_field) VALUES (2,'Highest Fictive Level',0);
    INSERT INTO ITEMS_LEVELS (item_level,item_field_name,item_field) VALUES (1,'Lowest Item Level',2);
    INSERT INTO ITEMS_LEVELS (item_level,item_field_name,item_field) VALUES (2,'Highest Fictive Level',0);
    INSERT INTO FORECAST_TREE (forecast_level,item_level,loc_level) VALUES (1,1,1);
    INSERT INTO FORECAST_TREE (forecast_level,item_level,loc_level) VALUES (2,1,2);
    INSERT INTO FORECAST_TREE (forecast_level,item_level,loc_level) VALUES (3,2,2);
    gives error due to a fact that all this tables (LOC_LEVELS, ITEMS_LEVELS, FORECAST_TREE) has column ENGINE_PROFILES_ID with nullable set to no.

    Hi,
    The problem is solved it was a constraint violation when creating the data model on the location levels.
    Thank you

  • Forms 6i problem in procedures for make update

    dear sirs,
    i had procedure to make update for tree of accounts, but make update to some levels and other level no, and here is the procedure if inside it any problem pls advice me
    CREATE OR REPLACE PROCEDURE updup_acc_trbal2(
    wyear IN NUMBER ,
    wperiod IN NUMBER ,
    wcost_center IN VARCHAR2 ,
    wacc_no IN VARCHAR2,
    wcurr_code IN VARCHAR2 ,
    lval_db IN NUMBER ,
    lval_cr IN NUMBER ,
    val_db IN NUMBER ,
    val_cr IN NUMBER )
    IS
    BEGIN
    declare
    ------------acc----
    acc_a varchar2(15);
    acc_b varchar2(15);
    cost_a varchar2(15);
    cost_m varchar2(15);
    cursor c0 is
    select a1,a2,a3,a4,a5,a6,a7,a8 from acc_master_file
    where acc_no = wacc_no;
    type acc_arr0 is table of varchar2(15)
    index by binary_integer;
    arr_acc acc_arr0;
    i binary_integer:= 0;
    -------------cost----
    cursor c is
    select c1,c2,c3,c4,c5,c6,c7,c8,c9 from cost_tables
    where cost_center = wcost_center;
    type acc_arr is table of varchar2(15)
    index by binary_integer;
    cost_acc acc_arr;
    i_cost binary_integer:= 0;
    begin
    open c0;
    fetch c0 into arr_acc(1),arr_acc(2),arr_acc(3),
    arr_acc(4),arr_acc(5),arr_acc(6),
    arr_acc(7),arr_acc(8);
    close c0;
    open c;
    fetch c into cost_acc(1),cost_acc(2),cost_acc(3),
    cost_acc(4),cost_acc(5),cost_acc(6),
    cost_acc(7),cost_acc(8),cost_acc(9);
    close c;
    i := 0;
    i_cost := 0;
    loop
    i_cost := i_cost + 1;
    exit when (i_cost > 9);
    loop
    i := i + 1;
    exit when (i > 8);
    acc_a := arr_acc(i);
    cost_a := wcost_center;--cost_acc(i_cost);
    cost_m := cost_acc(i_cost);
    acc_b := wacc_no;
    if cost_m is not null then
    if acc_a is not null then
    if acc_a <> wacc_no then --v then
    if cost_m <> wcost_center then
    update cost_bal
    set tr_deb = nvl(tr_deb,0) + nvl(lval_db,0),
    tr_cr = nvl(tr_cr,0) + nvl(lval_cr,0),
    c_tr_deb = nvl(c_tr_deb,0)+ nvl(val_db,0),
    c_tr_cr = nvl(c_tr_cr,0) + nvl(val_cr,0)
    where year = wyear
    and period_no = wperiod
    and acc_no = acc_a
    and cost_center = cost_m wcost_centercost_a
    and ((curr_code = wcurr_code
    and wcurr_code is not null)
    or(curr_code is null
    and wcurr_code is null));
    if sql%notfound then
    insert into cost_bal
    (year,period_no,cost_center,acc_no,curr_code,
    op_deb,op_cr,c_op_deb,c_op_cr,
    tr_deb,tr_cr,c_tr_deb,c_tr_cr,
    created_by,created_date,
    changed_by,changed_date)
    values
    (wyear,wperiod,cost_m,acc_a,wcurr_code,
    0,0,0,0,
    nvl(lval_db,0),nvl(lval_cr,0),nvl(val_db,0),
    nvl(val_cr,0),user,sysdate,null,null);
    end if;
    end if;
    end if;
    end if;
    end if;
    end loop;
    end loop;
    end;
    END updup_acc_trbal2;

    Please use below one:
    BEGIN
    if filename is null then
    filename := 'E:\STUDY\experiences\forms\tour\countries.txt';
    end if;
    MYFILE := TEXT_IO.FOPEN(FILENAME, 'R');
    SYNCHRONIZE;
    LOOP
    TEXT_IO.GET_LINE(MYFILE, LINEBUF);
    temp := temp + (length (LINEBUF));
    go_block('COUNTRIES');
    last_record; ---------------------------------
    next_record; ----------------------------------
    :country_code := LINEBUF || CHR(10);
    create_record;
    END LOOP;
    EXCEPTION
    when no_file then
    message('you can not access here. ' );
    END;

  • Problem:  The procedure entry point sqlite3_wd_checkpoint could not be located in the dynamic link library SQLite3.dll, Problem:  The procedure entry point sqlite3_wd_checkpoint could not be located in the dynamic link library SQLite3.dll

    Problem:  Every time the laptop is turned on, this message pops up:
    The procedure entry point sqlite3_wd_checkpoint could not be located in the dynamic link library SQLite3.dll
    Could someone please tell me if they have had the same problem and how they fixed it?  Thanking you in advance.  

    Sorry to inform you, that this is the iPod Classic Community forum, perhaps it would be best if you post your issue with the Microsoft Windows forum, or whatever software that is giving you this problem, but if it is iTunes try
    https://discussions.apple.com/community/itunes/itunes_for_windows
    Havea nice day!

  • Sintax problem in procedure..passing a date range

    Hio guys, I built an alter view using a stored procedure. Everything is ok ( it's a big procedure) but the date in where Archived..etc. It comes from the procedure below. Any advice? I tried with "' '" '' but nothing...syntax problem. Thanks a
    lot.
    with cte as (
    select nmonth, customer, [ecode], [echarge],archived from ArchiveBillable where Archived between 2014-11-03 and 2014-11-07
    or Archived between 2014-12-03 and 2014-12-07
    ), cte2 as (select nmonth, customer, [echarge], CONVERT(varchar(6), archived, 112) as archived
    from cte where [ecode] in ('armani','valentino')),
    cte3 as (
    select customer, archived,Nmonth, SUM(CAST([echarge] AS DECIMAL (20,4))) AS charge from cte2 group by
    customer, nmonth, archived)
    select * from cte3
    PIVOT
    sum(charge)
    FOR archived
    IN (
    [201411], [201412]
    ) AS PivotTableAlias
    select nmonth, customer, [ecode], [echarge],archived from ArchiveBillable where Archived between '+@fromone+' and '+@toone+'
    or Archived between '+@from+' and '+@to+'
    ), cte2 as (select nmonth, customer, [echarge], CONVERT(varchar(6), archived, 112) as archived
    from cte where [ecode] in (''armani'',''valentino'')),
    cte3 as (
    select customer, archived,Nmonth, SUM(CAST([element charge] AS DECIMAL (20,4))) AS charge from cte2 group by
    customer, nmonth, archived)
    select * from cte3
    PIVOT
    sum(charge)
    FOR archived
    IN (
    ['+@inPIVOT2+'], ['+@inPIVOT+']
    ) AS PivotTableAlias'

    Guys tanks to everyone, probably I didn't explain correctly my issue. Everything is fine, structure, data, date. Everything but this part (this is part of the view created by the procedure):
    select
    nmonth, customer,
    [element code], [element charge],archived
    from ArchiveBillable
    where Archived
    between
    2014-11-03
    and
    2014-11-07
    or Archived
    between
    2014-12-03
    and
    2014-12-07
    There is no apex.
    It should be:
    select
    nmonth, customer,
    [element code], [element charge],archived
    from ArchiveBillable
    where Archived
    between '2014-11-03'
    and '2014-11-07'
    or Archived
    between '2014-12-03'
    and '2014-12-07'
    with the apex.
    The part of the procedure involved:
    DECLARE
    @From varchar(10)
    DECLARE
    @To varchar(10)
    DECLARE
    @FromOne varchar(10)
    DECLARE
    @ToOne varchar(10)
    DECLARE
    @FIRSTALTER VARCHAR(MAX)
    DECLARE
    @SECONDALTER VARCHAR(MAX)
    DECLARE
    @inPIVOT VARCHAR(6)
    DECLARE
    @inPIVOT2 VARCHAR(6)
    SELECT
    @FirstDayOfCurrentMonth =
    DATEADD(MONTH,
    DATEDIFF(MONTH,
    '01/01/1900',
    Current_timeStamp),
    '01/01/1900')
    SELECT
    @From
    =DATEADD(DAY,
    2, @FirstDayOfCurrentMonth)
    @To=DATEADD(DAY,
    6, @FirstDayOfCurrentMonth)
    @FromOne=DATEADD(DAY,
    2,
    DATEADD(MONTH,
    -1,
    @FirstDayOfCurrentMonth))
    @ToOne=DATEADD(DAY,
    6,
    DATEADD(MONTH,
    -1,
    @FirstDayOfCurrentMonth))
    set
    @inPIVOT=left(@from,4)+SUBSTRING(@from,6,2)
    set
    @inPIVOT2=left(@fromone,4)+SUBSTRING(@fromone,6,2)
    SET
    @FIRSTALTER='Alter view
    ChargePivot as
    with cte as (
    select nmonth, customer, [ecode], [echarge],archived from ArchiveBillable where Archived between '
    +@fromone+'
    and '+@toone+'
    or Archived between '
    +@from+'
    and '+@to+'
    ), cte2 as (select nmonth, customer, [echarge], CONVERT(varchar(6), archived, 112) as archived
    from cte where [ecode] in (''armani'',''valentino'')),
    cte3 as (
    select customer, archived,Nmonth,  SUM(CAST([element charge] AS DECIMAL (20,4))) AS charge from cte2 group by 
    customer, nmonth, archived)
    select * from cte3
    PIVOT
       sum(charge)
       FOR archived
       IN (
    +@inPIVOT2+'],
    ['+@inPIVOT+']
    ) AS PivotTableAlias'
    exec
    (@firstalter)
    I pass the parameter but I don't pass the apex...

  • Strange problem with procedure calling from Java!!!

    I am using Oracle 8.1.7 Database, Oracle 8i Application server and WInNT platform.
    I am facing a strange problem while inserting a String from Java to Oracle database through Procedure. When i am passing the String containing single quotes(e.g "test' and ' and ' end") and without including any escape charactes for the single quotes I am passing the String by the setString() method then the procedure is inserting the single quotes without any problem.
    Of course when I am independently executing the procedure thru backend and passing the same String containing single quotes then the error message comes as " quoted string not properly terminated" which is justified,
    I have even printed the String in a file through sql on the runtime of the procedure when it is called by Java and then also the String contatins single quotes that is passed through java without any escape characters. This means that procedure is inserting the String into the column without any hassles!!!!!
    Can anyone tell me what may be the reason for the peculiar behaviour of Database?
    Thanks

    Sri Ram wrote:
    No actually in the documentation of oracle database 10g plsql user guide, oracle explains the concept of declaring nested plsql subprograms he gave the example but in the main block he gave NULL, without calling any procedure.Can you provide a link to where in the Oracle documentation you saw this example?
    in order to know which procedure is getting first i added a dbms statement in both the functions and called the function from the main block.
    the original example was
    DECLARE
    PROCEDURE proc1(number1 NUMBER); -- forward declaration
    PROCEDURE proc2(number2 NUMBER) IS
    BEGIN
    proc1(number2); -- calls proc1
    END;
    PROCEDURE proc1(number1 NUMBER) IS
    BEGIN
    proc2 (number1); -- calls proc2
    END;
    BEGIN
    NULL;
    END;
    ---------------------------------------------------------------------------------------------------------The original example is equivalent to:
    BEGIN
       NULL;
    END;That is, the main block never calls anything. Either you are misinterpreting the Oracle documentation, or if the example came from a non-Oracle source as I suspect, the author of that example has a deeply flawed understanding of how programming works.
    John

  • Problem on procedure import wizard

    I have a very strange problem on importing procedure on OWB.
    The installed software is:
    Oracle DB 10g
    Oracle Warehouse Builder 10.2.0.4
    on Windows Vista.
    The problem is that within the procedure import wizard I cannot view all of the procedures that are phisically stored on the repository.
    If I create a procedure with any editor like TOAD, this new procedure is not available in the list of the wizard.
    For all of the others object this problem doesn't exist, so I can import all the tables, functions, sequence.. stored on the repository.
    About the deploy I have no problem on any object. So I can deploy tables,function,PROCEDUREs and so on created on the Design Center.
    The only problem I have is about importing procedures.
    Can u help me?

    This might stupid buit still worth saying it:
    In Owb client:
    Under your repository ==> Databases ==> Oracle --> EMP( Schema which is registered and there is an entry in connection explorer for this schema)
    Under your repository ==> Databases ==> Oracle --> HR( Schema which is registered and there is an entry in connection explorer for this schema)
    when you click on transformations ==> Import within EMP Schema, you will be able to view all procedures which are in EMP schema and not procedures under HR schema.
    Trust all your procedures are in one schema dn the schema where all this exists is registered in your connection explorer i.e it points to the correct location like DEV or Test or Prod etc.
    If all of this is correct then there is no reason why the procedures should not be visible.

  • Problem in Procedure for using sequence...

    Hi,
    I created a procedure for generating sequence in target using below query
    SELECT EMP.EMP_SEQ.NEXTVAL FROM DUAL
    but its working on one system in other system its giving below error...
    ODI-1228: Task EMP_LOAD_EMP_SEQ_PROC (Procedure) fails on the target ORACLE connection EMP_LOAD.
    Caused By: java.sql.SQLException: SQL string is not a DML Statement at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1393)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3752)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3887)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1508)
    at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java:665)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeUpdate(SnpSessTaskSql.java:3218)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders(SnpSessTaskSql.java:1785)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2805)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1818)
    at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$2.doAction(StartScenRequestProcessor.java:559)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
    at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor.doProcessStartScenTask(StartScenRequestProcessor.java:481)
    at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$StartScenTask.doExecute(StartScenRequestProcessor.java:1040)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:619)
    Please help me regarding this issue..
    Thanks in Advance...

    Odi Procedures are mainly meant for DML execution..A SELECT query there holds little or no value in my opinion..
    Select queries are only usable in Command on Source and there the general application of that is to use those values returned by the SELECT query on Command Source as a input to the Command/Query/Statement/Java or Jython block at the Command on Target Tab in a one by one iterative manner.
    Lets say your command on source returns 5 rows..So your command on target is executed 5 times and you can use the attributes of these rows as inputs to your command on target in each iteration .. It works like an Internal Cursor

  • Problem with procedures...

    hi all, I am creating a Times Tables (1 x 1, 3 x 5 etc...).
    I am having trouble with the setting up the procedures. In this case the user must select between 1 - 4.
    1 = multiplication
    2 = divide
    3 = add
    4 = subtract
    I am using If / else statemtents to direct to the appropriate procedure but am having errors as follows:
    .java:67: 'else' without 'if'
    else
    Here is the code I am using up to now:
    class assign2{
         public static void main(String[]args){
              int table;
              int lines;
              int type;
              do
                   System.out.println("Please enter the times tables required (1 - 12)");
                   Keyboard.skipLine();
                   table = Keyboard.readInt();
                   if (table < 1 || table > 12)
                   System.out.print("INVALID ENTRY - Please try again and enter between 1 and 12"); // (C) Error msg if invalid
                   System.out.println();
    }while (table < 1 || table > 12);
    do
         System.out.println("Please enter the number of lines required (1 - 12)");
         Keyboard.skipLine();
         lines = Keyboard.readInt();
                   if (lines < 1 || lines > 12)
                   System.out.print("INVALID ENTRY - Please try again and enter between 1 and 12"); // (C) Error msg if invalid
                   System.out.println();
    }while (lines < 1 || lines > 12);
              do
                   System.out.println("Please select the table type from one of the following (1 - 4): ");
                   System.out.println();
                   System.out.println("1 = Multiplication");
                   System.out.println("2 = Division");
                   System.out.println("3 = Addition");
                   System.out.println("4 = Subtraction");
                   Keyboard.skipLine();
                   type = Keyboard.readInt();
                   if (type != 1 && type != 2 && type != 3 && type != 4)
                   System.out.print("INVALID ENTRY - Please try again and select between 1 and 4 "); // (C) Error msg if invalid
                   System.out.println();
              }while (type != 1 && type != 2 && type != 3 && type != 4);
              if (type == 1)
                   getMultiply();
              else
              if (type == 2)
                   getDivide();
              else
              if (type == 3);
                   getAdd();
              else
              if (type == 4);
                   getSubtract();
              static void getMultiply(){
                   System.out.println("This is mulitply!!!");
              static void getDivide(){
                   System.out.println("This is divide!!!");
              static void getAdd(){
                   System.out.println("This is Add!!!");
              static void getSubtract(){
                   System.out.println("This is Subtract!!!");

    Multi-Post:
    http://forum.java.sun.com/thread.jspa?threadID=5122115&tstart=0

  • Problem in Procedure compilation

    CREATE OR REPLACE PROCEDURE leave_emp
    (p_id IN employees.employee_id%TYPE)
    IS
    BEGIN
    DELETE FROM employees
    WHERE employee_id = p_id;
    log_execution;
    END
    leave_emp;
    While i am compiling the above procedure, i got the below error:
    CREATE OR REPLACE PROCEDURE leave_emp IS
    ERROR at line 1:
    ORA-01031: insufficient privileges
    Please help me to solve this issue. Thanks in advance

    When faced with this lind of issue it's a good idea to look up the relevant commands in the documentation (in this case the CREATE PROCEDURE statement in the SQL Reference) and check the "prerequisites" section. In this case it tells you that you need the CREATE PROCEDURE system privilege.
    CREATE ANY PROCEDURE allows you to create a procedure in any schema, not just your own. Add EXECUTE ANY PROCEDURE and you would have the power of God within that database.

  • Performance Problem in Procedure

    Hello All,
    Env: 10gR2 on Solaris
    I have a procedure in my TEST and PROD. In TEST it takes around 5 secs and in PROD it takes around 40 secs.
    I put a trace on both.
    PROD*
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1     39.74      38.81          0          0          0           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        2     39.74      38.81          0          0          0           1
    Misses in library cache during parse: 0
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      log file sync                                   2        0.00          0.00
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     2       12.16         12.17
    TEST*
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      5.72       5.63          0          0          0           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      5.72       5.63          0          0          0           1
    Misses in library cache during parse: 0
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      log file sync                                   2        0.05          0.05
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     2        3.72          3.74The cost is more while its run on the prod.
    The trace file shows many sql's, almost all the tables used are tables of very small (count = 9 or 30 etc).
    The plan for most the sql's are same in both DB's, but the time taken per step is more in PROD.
    One the sql is below.
    PROD*
    DELETE FROM GTT_REPAYMENT_SCHEDULE
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      2      0.00       0.00          0          3          1           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        3      0.00       0.00          0          3          1           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 118     (recursive depth: 1)
    Rows     Row Source Operation
          0  DELETE  GTT_REPAYMENT_SCHEDULE (cr=3 pr=0 pw=0 time=429 us)
          1   TABLE ACCESS FULL GTT_REPAYMENT_SCHEDULE (cr=3 pr=0 pw=0 time=161 us)
    TEST*
    DELETE FROM GTT_REPAYMENT_SCHEDULE
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      2      0.00       0.00          0          3          1           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        3      0.00       0.00          0          3          1           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 64     (recursive depth: 1)
    Rows     Row Source Operation
          0  DELETE  GTT_REPAYMENT_SCHEDULE (cr=3 pr=0 pw=0 time=276 us)
          1   TABLE ACCESS FULL GTT_REPAYMENT_SCHEDULE (cr=3 pr=0 pw=0 time=112 us)The 'time' varies in both the plans, what is this *'us'*. How many 'us' is 1 second ?
    Its the same for all the sql's. The 'time' varies largely.
    How would i improve the performance in Prod. Any clue?
    TIA,
    JJ

    Hi,
    I have removed all the DBMS_OUTPUT lines and executed. But there isn't any difference.
    I have uploaded the trace Prod without DBMS_OUTPUT : http://biscut.wordpress.com/2008/10/17/trace-in-prod-without-dbms_output/
    gejcllcal_jw_100_01 is a procedure which is called in my plsql, which in turn calls a couple of procs
    Procedure :http://biscut.wordpress.com/2008/10/17/procedure/
    As you said, if the total execution time comes only until 1.12 secs, what constitutes the rest? :(
    TIA,
    JJ

  • Problem calling procedure

    Hi
    This is my first day at SQL procedures, apologies if this question is dumb
    I have written this procedure which compiles ok:
    CREATE PROCEDURE ADDLOCATION (lid IN locations.location_id%TYPE, ldes IN locations.description%TYPE)AS
    BEGIN
         INSERT INTO LOCATIONS (location_id,description)
         VALUES (lid,ldes);
    END ADDLOCATION;
    /When I try to call this procedure within the script below, it does not work. Am I not allowed call a procedure from within the BEGIN clause or is my syntax wrong? Can someone explain why or explain the error message I am getting->(PLS-00103: Encountered the symbol "ADDLOCATION" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "ADDLOCATION" to continue.)
    Thanks a mil :)
    DECLARE
           highestlid locations.location_id%TYPE;
    BEGIN
           SELECT
                max(location_id)
           INTO
                highestlid
           FROM
                locations;
           highestlid:=highestlid+1;
           CALL ADDLOCATION(highestlid,'Lucan');
    END;
    /

    DECLARE
           highestlid locations.location_id%TYPE;
    BEGIN
           SELECT
                max(location_id)
           INTO
                highestlid
           FROM
                locations;
           highestlid:=highestlid+1;
           ADDLOCATION(highestlid,'Lucan');
    END;
    /

  • Problems with procedures with DEFAULT parameters on 9i

    The Forms builder shuts down when compiling a block that contains the reference to a stored procedure (packaged or not) that contains a defaulted parameter.
    Sometimes it just terminates the connection (ORA-3113)
    Is there a patch or a parameter setting that circumvents this failure?

    Hi Hema,
    There could be various things that explain this, but from your symptoms it looks like the engine is hung processing this report. This could be as simple as a PL/SQL trigger that is in an infinite loop. Anyway, a simple thing to do is to add TRACEFILE=filename&TRACEMODE=append&TRACEOPTS=TRACE_ALL onto your URL. This will create the specified file and dump information into it about what Reports is doing as it is processing your report. If it is hung in an infinite loop, you should be able to see how far it got when you kill it.
    Also, you can see the status of the reports job queue by using the http://.../rwcgi60?showjobs command. If the report is executing forever, you'll see it sitting there in the job queue.
    regards,
    Stewart

  • Problem calling Procedure with parameter from Dynamic Page

    I received an error saying the Page not found
    here's how to reproduce the error.
    1. Create procedure in portal30 schema.
    Create or Replace PROCEDURE PORTAL30.ADD_TWO_VALUES
    v_one IN NUMBER,
    v_two IN NUMBER,
    v_result OUT NUMBER)
    as
    begin
    v_result :=v_one+v_two;
    end;
    2. Create Dynamic Page with following code
    <ORACLE>DECLARE
    v_total NUMBER;
    BEGIN
    ADD_TWO_VALUES(:v_one,:v_two, v_total);
    htp.p('The total is => ');
    htp.p('<input type="TEXT" VALUE='||v_total||'>');
    htp.para;
    htp.anchor('http://<machine.domain:port#>/pls/portal30/PORTAL30.DYN_
    ADD_TWO_VALUES.show_parms', 'Re-Execute Procedure');
    END;</ORACLE>
    3. I clicked on Customize Link and entered 2 numbers as values for v_one and v_two.
    4. Got "The page cannot be found" error in I.E. or "The requested URL /pls/portal30/PORTAL30.DYN_SAMPLE_ADD.show was not found on this server." on Netscape
    However when I subsitute "ADD_TWO_VALUES(:v_one,:v_two, v_total);" in the dynamic page for "ADD_TWO_VALUES(3,2, v_total);", it runs just fine.
    What's wrong here? Can I not use a parameter from a dynamic page and call a procedure with it? Help is needed urgently and will be greatly appreciated.
    -Ahsun

    Hi,
    I tried with your code with few changes ,please try with them.
    Create or Replace PROCEDURE <myschema>.ADD_TWO_VALUES
    v_one IN NUMBER,
    v_two IN NUMBER,
    v_result OUT NUMBER)
    as
    begin
    v_result :=v_one+v_two;
    end;
    I created the procedure in <mySchema> and granted that to <application_schema> and made some changes
    <ORACLE>
    DECLARE
    v_total NUMBER;
    BEGIN
    <procedure_schema>.ADD_TWO_VALUES(:v_one,:v_two, v_total);
    htp.p('The total is => ');
    htp.p('<input type="TEXT" VALUE='||v_total||'>');
    htp.para;
    htp.anchor('http://<your_host>/pls/<portal_schema>/<application_schema>.DYN_FOR_OTN.SHOW_PARMS', 'Re-Execute Procedure');
    END;
    </ORACLE>
    Hope this helps.
    rahul

Maybe you are looking for