Using Connect within a PL/SQL block

Hi,
I have a package, inside that i have many procedures & functions, in one of my procedure, i want to use [connect username/password] within a procedure.
This procedure is called by our client program (in VC++), they will just call the procedure name with parameters, but the procedure should internally connect to one more user & perform some dba related operations, all these things are done in the procedure only, clint will not be aware of the internal operations.
I tried to give connect within the procedure,
it gives an error Invalid SQL stmt while compiling the package. Is there any way to do this.
Pls. reply me back.
Bye
null

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by pratibha:
Hi,
I have a package, inside that i have many procedures & functions, in one of my procedure, i want to use [connect username/password] within a procedure.
This procedure is called by our client program (in VC++), they will just call the procedure name with parameters, but the procedure should internally connect to one more user & perform some dba related operations, all these things are done in the procedure only, clint will not be aware of the internal operations.
I tried to give connect within the procedure,
it gives an error Invalid SQL stmt while compiling the package. Is there any way to do this.
Pls. reply me back.
Bye
<HR></BLOCKQUOTE>
null

Similar Messages

  • Not able to display javascript alert message from within a pl/sql block

    Hello,
    Can anyone please help me out with this issue. I wanted to display an javascript alert message from within a pl/sql block for an update button. Below is sample code which i am using. P1_ITEM is my hidden item on the report.
    begin
    if :P1_ITEM IS NOT NULL then
    HTP.p ('<script type="text/javascript">');
    HTP.p ('alert(''Please complete the item which is already assigned to you!'');');
    HTP.p ('</script>');
    end if;
    end;
    and I have made this code to be executed conditionally when request = Expression1
    Expression1: SUBMIT
    The thing is I am not able to display an alert message when the update button is clicked.
    Can anyone please help me with this one.
    Thanks,
    Orton

    varad but I also have an update statement within that block for the update button something like this i want to achieve.
    begin
    if :P1_ITEM IS NULL THEN
    update sample_tbl
    set col1 =:APP_USER,
    col2 = 'Y'
    where pk_col = ---;
    commit;
    HTP.p ('<script type="text/javascript">');
    HTP.p ('alert(''Successfully assigned an item!'');');
    HTP.p ('</script>');
    end if;
    if :P1_ITEM IS NOT NULL then
    HTP.p ('<script type="text/javascript">');
    HTP.p ('alert(''Please complete the item which is already assigned to you!'');');
    HTP.p ('</script>');
    end if;
    end;
    thanks,
    Orton

  • Insert Stmt behaving differently within a PL/SQL block than independently

    I have an INSERT INTO statement that is behaving different within a PL/SQL block than it does if ran as an independent SQL query. When executed within a PL/SQL block the INSERT statement does insert rows, but only less than 50% of the rows returned by the SELECT statement used by the INSERT. There are no constraints and the only check on the destination table is a NOT NULL for supplier_id column.
    BEGIN
        INSERT INTO suppliers (supplier_id, supplier_name)
        SELECT account_no, name FROM customers WHERE city = 'Newark';
    END;Can anyone help me with this?
    Thanks

    Thought this sounded familiar:
    INSERT INTO statement that is behaving different within a PL/SQL block

  • Why named parameter can't be used multiple times in PL/SQL block in JDBC

    with the following PL/SQL block, when I run int in JDBC, I get an error,
    it says, The number of parameter names does not match the number of registered parameters.
    if all named parameters are used only once, then my program works fine.
    My old program uses Oracle Forms to run the attached PL/SQL block correctly, I just want to run them in JDBC without more efforts, I don't want to rewrite all PL/SQL blocks.
    Does oracle driver support this case? why the PL/SQL block can work in Oracle Forms but failed in JDBC?
    Can we have an another solutions to avoid rewriting the PL/SQL block to stored procedure?
    if I use following SQL:
    BEGIN if :q is null then :q := 'X'; else :q := 'Y'; end if; END;
    , Using java program:
    import java.sql.*; public class RunPLSQLBlock { public static void main(String s[]) throws SQLException { String URL = "jdbc:oracle:thin:@192.168.11.199:1521:TIBSTEST"; Connection con = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = (Connection) DriverManager.getConnection(URL, "FBP1DEV", "FBP1DEV"); String SQL = "BEGIN  if :q is null then  :q := 'X'; else :q := 'Y'; end if; END;"; CallableStatement stmt = con.prepareCall(SQL); stmt.registerOutParameter("q", Types.VARCHAR); stmt.setString("q", "A"); stmt.execute(); } catch (Exception e) { e.printStackTrace(); } finally { if (con != null) { con.close(); } } } }
    in the coding, only "q" registered, I got:
    java.sql.SQLException: The number of parameter names does not match the number of registered praremeters at oracle.jdbc.driver.OracleSql.setNamedParameters(OracleSql.java:314) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:10096) at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:5693) at RunPLSQLBlock.main(RunPLSQLBlock.java:28)
    now, tried to register 3 indexes, changed fragments are below.
    import java.sql.*; public class RunPLSQLBlock { public static void main(String s[]) throws SQLException { String URL = "jdbc:oracle:thin:@192.168.11.199:1521:TIBSTEST"; Connection con = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = (Connection) DriverManager.getConnection(URL, "FBP1DEV", "FBP1DEV"); String SQL = "BEGIN  if :q is null then  :q := 'X'; else :q := 'Y'; end if; END;"; CallableStatement stmt = con.prepareCall(SQL); stmt.registerOutParameter(1, Types.VARCHAR); stmt.registerOutParameter(2, Types.VARCHAR); stmt.registerOutParameter(3, Types.VARCHAR); stmt.setString(1, "A"); stmt.execute(); } catch (Exception e) { e.printStackTrace(); } finally { if (con != null) { con.close(); } } } }
    now error changed to:
    java.sql.SQLException: ORA-01006: bind variable does not exist at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:400) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:926) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:200) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:543) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:208) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1416) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1757) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4372) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:4595) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:10100) at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:5693) at RunPLSQLBlock.main(RunPLSQLBlock.java:26)
    , now tried register only 1 position like below,
      CallableStatement stmt = con.prepareCall(SQL);   stmt.registerOutParameter(1, Types.VARCHAR);   stmt.setString(1, "A");   stmt.execute();
    , it says:
    java.sql.SQLException: Missing IN or OUT parameter at index:: 2 at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:2177) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4356) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:4595) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:10100) at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:5693) at RunPLSQLBlock.main(RunPLSQLBlock.java:26)
    , now let try a OK case, which use all named parameters only once. coding like below, SQL and Java listed below.
    BEGIN if :q is null then :r := 'X'; else :s := 'Y'; end if; EXCEPTION   WHEN NO_DATA_FOUND THEN     NULL; END;
    import java.sql.*; public class RunPLSQLBlock { public static void main(String s[]) throws SQLException { String URL = "jdbc:oracle:thin:@192.168.11.199:1521:TIBSTEST"; Connection con = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = (Connection) DriverManager.getConnection(URL, "FBP1DEV", "FBP1DEV"); String SQL = "BEGIN  if :q is null then  :r := 'X'; else :s := 'Y'; end if; END;"; CallableStatement stmt = con.prepareCall(SQL); stmt.registerOutParameter("q", Types.VARCHAR); stmt.registerOutParameter("r", Types.VARCHAR); stmt.registerOutParameter("s", Types.VARCHAR); stmt.setString("q", "A"); stmt.execute(); System.out.println("Q :" + stmt.getString("q")); System.out.println("R :" + stmt.getString("r")); System.out.println("S :" + stmt.getString("s")); } catch (Exception e) { e.printStackTrace(); } finally { if (con != null) { con.close(); } } } }
    , the case give us the following output:
    Q :A R :null S :Y
    2nd part, I also tried another scheme, to use 'execute immediate', test code attached below, it also have errors.
    begin execute immediate 'begin if :q is null then :q := ''X''; else :q := ''Y''; :r := ''Z''; end if; end;' using in out :q, out :r; end;
    , Java Code:
    import java.sql.*; public class RunDynamicSQL { public static void main(String s[]) throws SQLException { String URL = "jdbc:oracle:thin:@192.168.11.199:1521:TIBSTEST"; Connection con = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = (Connection) DriverManager.getConnection(URL, "FBP1DEV", "FBP1DEV"); String SQL ="begin execute immediate 'begin if :q is null then :q := ''X''; else :q := ''Y''; :r := ''Z''; end if; end;' using in out :q, out :r; end;"; CallableStatement stmt = con.prepareCall(SQL); stmt.registerOutParameter("q", Types.VARCHAR); stmt.registerOutParameter("r", Types.VARCHAR); stmt.setString("q", "A"); stmt.execute(); System.out.println("Q :" + stmt.getString("q")); System.out.println("R :" + stmt.getString("r")); } catch (Exception e) { e.printStackTrace(); } finally { if (con != null) { con.close(); } } } }
    , the output is, we can find when parameter 'q' is IN OUT mode, we can't get its final value:
    Q :null R :Z
    , now I tried my workaround, it works fine by using a temporary variable, now my named parameter is split to 2 roles, one is for IN, another is for OUT, now I can get final out value.
    declare q clob; r clob; begin q := ?; r := ?; execute immediate 'begin if :q is null then :q := ''X''; else :q := ''Y''; :r := ''Z''; end if; end;' using in out q, out r; ? := q; ? := r; end;
    , my test java code,
    import java.sql.*; public class RunDynamicSQL { public static void main(String s[]) throws SQLException { String URL = "jdbc:oracle:thin:@192.168.11.199:1521:TIBSTEST"; Connection con = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = (Connection) DriverManager.getConnection(URL, "FBP1DEV", "FBP1DEV"); String SQL ="declare q clob;r clob; begin q := ?; r := ?; execute immediate 'begin if :q is null then :q := ''X''; else :q := ''Y''; :r := ''Z''; end if; end;' using in out q, out r; ? := q; ? := r; end;"; CallableStatement stmt = con.prepareCall(SQL); stmt.registerOutParameter(3, Types.VARCHAR); stmt.registerOutParameter(4, Types.VARCHAR); stmt.setString(1, "A"); stmt.setString(2, "A"); stmt.execute(); System.out.println("Q :" + stmt.getString(3)); System.out.println("R :" + stmt.getString(4)); } catch (Exception e) { e.printStackTrace(); } finally { if (con != null) { con.close(); } } } }
    , the output is expected,
    Q :Y R :Z
    Database:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    JDBC Driver, extracted from ojdbc6_g.jar/META-INF/MANIFEST.MF :
    Created-By: 1.5.0_30-b03 (Sun Microsystems Inc.)
    Implementation-Vendor: Oracle Corporation
    Implementation-Title: JDBC debug
    Implementation-Version: 11.2.0.3.0
    Repository-Id: JAVAVM_11.2.0.3.0_LINUX_110823
    Specification-Vendor: Sun Microsystems Inc.
    Specification-Title: JDBC
    Specification-Version: 4.0
    Main-Class: oracle.jdbc.OracleDriver
    JDK:
    java version "1.7.0"
    Java(TM) SE Runtime Environment (build 1.7.0-b147)
    Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
    Edited by: jamxval on 2013-3-22 2:01PM (UTC+08:00), Give full test java program and SQL, added environment/API level; Attached another problem.
    Edited by: jamxval on 2013-3-26 17:57 (UTC +08), Adjust code style

    Hi, thanks for your response, now I see, the named parameter is for stored procedure only, for PL/SQL block we name it placeholder name.
    After cast my java.sql.CallableStatement to oracle.jdbc.OracleCallableStatement, I can find setStringAtName,
    now, I have only one question:I can't find corresponding methods for registerOutputParameter, how we fetch output value?
    I tried to callableStatement.getString("q"); it reports errors, but there are no ordinal binding in my source code, does placeholder names doesn't support OUT mode?
    Java:
    CallableStatement stmt = con.prepareCall("BEGIN  if :q is null then  :r := 'X'; else :s := 'Y'; end if; END;");
    oracle.jdbc.OracleCallableStatement call = (oracle.jdbc.OracleCallableStatement) stmt;
    call.registerOutParameter("q", Types.VARCHAR);
    call.registerOutParameter("r", Types.VARCHAR);
    call.registerOutParameter("s", Types.VARCHAR);
    call.setStringAtName("q", "A");
    call.setStringAtName("r", "A");
    call.setStringAtName("s", "A");
    call.execute();
    System.out.println("Q :" + call.getString("q"));
    </Java>
    <output>
    java.sql.SQLException: 不允许的操作: Ordinal binding and Named binding cannot be combined!
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
         at oracle.jdbc.driver.OracleCallableStatement.getString(OracleCallableStatement.java:2834)
         at RunPLSQLBlock.main(RunPLSQLBlock.java:33)
    </output>by the way, in my below-mentioned SQL 'problematic', when my code uses 'execute immediate' and use placeholder names in IN OUT mode, we always get NULL value (i.e. ':q'), but we can get final value of ':r' when ':r' is OUT mode only; now I get a workaround attached in below-mentioned 'my workaround' block, which split the IN OUT roles to 2 parts, it can work now;
    It seems that the difference between 'problematic' and 'my workaround' imply that there are something work unexpectedly when the driver process the placeholder names, because 'my workaround' and ':r in problematic case' make sure the 'execute immediate' returned output values correctly, unluckly driver layer can't get return values.
    <SQL name = 'problematic'>
    begin
         execute immediate 'begin if :q is null then :q := ''X''; else :q := ''Y''; :r := ''Z''; end if; end;'
         using in out :q, out :r;
    end;
    </SQL>
    <SQL name='my workaround'>
    declare     
         q clob;
         r clob;
    begin
         q := ?;
         r := ?;
         execute immediate 'begin if :q is null then :q := ''X''; else :q := ''Y''; :r := ''Z''; end if; end;' using in out q, out r;
         ? := q;
         ? := r;
    end;Edited by: EJP on 26/03/2013 14:14

  • Can't create a sequence within a pl/sql block with execute immediate.

    Hi All. I created a user and granted it the 'create sequence' privilege though a role. In a pl/sql block I try to create a sequence using 'execute immediate' but get a 1031-insufficient privileges error. If I grant create sequence directly to the user, the pl/sql block completes successfully. Can anyone explain this behavior? We're running 11.2 Enterprise Editon.
    Thanks,
    Mark

    In a definer's rights stored procedure (the default), you only have access to privileges that have been granted directly, not via a role.
    There are two basic reasons for that. First, roles can be enabled or disabled, default and non-default, password-protected, etc. so the set of roles a particular user actually has is session-specific. Oracle needs to know at compile time what privileges the owner of the procedure has. The only way to do that (without deferring the privilege check) is to ignore privileges granted through roles.
    Second, since 99% of privilege management DBAs do involves granting and revoking roles, it's helpful that changing role privileges will never cause objects to be marked invalid and recompiled which can have side-effects on applications. DBAs only need to worry about causing problems on those rare cases where they are granting or revoking direct privileges to users.
    You can create an invoker's rights stored procedure by adding the clause (AUTHID CURRENT_USER). That defer's the security check to run-time but allows the procedure to see privileges granted through roles in the current session. But that means that the caller of the procedure would need to have the CREATE SEQUENCE privilege through the role, not the owner of the procedure.
    And just to make the point, dynamic object creation in PL/SQL is almost always a red flag that there is something problematic in your design. If you are creating sequences dynamically, that means that you'd have to refer to them dynamically throughout your code which means that your inserts would need to use dynamic SQL. That's not a particularly easy or safe way to develop code.
    Justin

  • Encountering transaction statement from within a PL/SQL block

    Hi All,
    i would like to know what will be the transaction status if we use an commit or a rollback statement inside a PL/SQL procedure called from within an PL/SQL package.
    For example
    BEGIN
    select statement
    insert statement 1
    .... call to <xyz> procedure
    end;
    xyz procedure
    insert statement 2
    commit/rollback
    end of procedure
    will the insert statement 1 be commited/rollbacked when the session encounters the transaction statement inside the procedure.

    Welcome to the forum!
    Unless the procedure xyz is an autonomous transaction, then yes Insert statement 1 will be committed.

  • Error in using external procedure in PL/SQL Block

    After setting up the configuration : Respective entries in
    tnsnames.ora
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    (CONNECT_DATA = (SID = PLSExtProc)(SERVER=DEDICATED))
    and listner.ora :
    (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = mymachine )(SID_NAME = mysid)) (SID_DESC = (GLOBAL_DBNAME = mymachine )(SID_NAME = myid1))
    (SID_DESC = (GLOBAL_DBNAME = mymachine )(SID_NAME = myid2))
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /oracle9i)
    (PROGRAM = extproc)
    (ENVS="EXTPROC_DLLS = ANY" // Added this entry
    (SID_DESC =
    (GLOBAL_DBNAME = oracle9i)
    (ORACLE_HOME = /oracle9i)
    (SID_NAME = oracle9i)
    (ENVS="EXTPROC_DLLS= ANY") // Added this entry
    Wrote the program as :
    ===========================================================
    #include <stdio.h>
    #include<stdlib.h>
    void sh(char *command) {
    int num;
    num = system(command);
    ===========================================================
    Compiled the file (above ) shell.c as :
    gcc -c shell.c
    Made the library as :
    ld -r -o shell.so shell.o
    chmod 777shell.so
    copied the file to respective Home directories. Made one link to /usr/lib :
    which is in LD_LIBRARY_PATH
    created the Library as :
    CREATE OR REPLACE PROCEDURE shell(command IN char)
    AS EXTERNAL
    NAME "sh"
    LIBRARY shell_lib
    LANGUAGE C
    PARAMETERS (command string);
    So my problem is
    when executing the procedure from SQL prompt:
    SQL> exec shell('any command');
    it throws the following errors :
    BEGIN shell('ls'); END;
    ERROR at line 1:
    ORA-06520: PL/SQL: Error loading external library
    ORA-06522: /opt/sotas/bin/shell.so: only ET_DYN and ET_EXEC can be loaded
    ORA-06512: at "CDR_ADMIN.SHELL", line 0
    ORA-06512: at line 1
    Any help or suggestions would be appreciated
    Thanks in advance......
    Made one Link to /usr/lib

    Nikolai,
    I have created a simple process flow which only calls the external process. The script is on the same host as the process flow is deployed to.
    I have used two diffent values for the command parameter.
    1. I placed the full path of the file in the command parameter and left the script parameter blank:
    COMMAND: /edwftp/ppas/scripts/ClearPPAS.sh
    PARAMETER_LIST:
    SUCCESS_THRESHOLD: 0
    SCRIPT:
    2.I placed the bash command in the command parameter and the full path in the script parameter.
    COMMAND: /usr/bin/sh
    PARAMETER_LIST:
    SUCCESS_THRESHOLD: 0
    SCRIPT: /edwftp/ppas/scripts/ClearPPAS.sh
    Both of these appear to work as they print out the statements inside the script but the files that are supposed to be removed still remain.
    Starting Execution EXTER_FILE
    Starting Task EXTER_FILE
    Starting Task EXTER_FILE:EXTERNALPROCESS
    Removing ActivatedAudit.dat...
    Removing ActivatedCustomers.dat...
    Removing ActiveAudit.dat...
    Removing ActiveCustomers.dat...
    Done!
    Create the Activated Customers data file...
    Create the Active Customers data file...
    Done!
    WARNING: Log file truncated - see RAB for further information.
    /edwftp/ppas/scripts/ActivatedCustomers.sh: /edwftp/ppas/log/ActivatedCustomers.log: cannot create
    /edwftp/ppas/scripts/ActiveCustomers.sh: /edwftp/ppas/log/ActiveCustomers.log: cannot create
    WARNING: Log file truncated - see RAB for further information.
    Completing Task EXTER_FILE:EXTERNALPROCESS
    Completing Task EXTER_FILE
    Completing Execution EXTER_FILE
    The permissions on the /log direcotry are 775. The user I register the file location with owns this directory.
    Can't think of anything else I have missed. I really appreciate your help :)
    Ryan

  • Using Connect prior option in sql

    HI,
    when i tried the below query it is resulting the rows as below
    select level,ssn,report_to, baid
    from table1
    where ssn not in (select e.ssn
    from table1 e, .
    table2 s
    where e.ssn = s.ssn)
    start with ssn in (select e.ssn
    from table1 e)
    connect by prior report_to=baid;
    Result
    LEVEL SSN REPORT_TO BAID
    1 UNKSSN BFTXQ6Q 0
    2 1444595 BAT35YW BFTXQ6Q
    3 1480160 BL2Y2K1 BAT35YW
    4 1200802 BAKA5T5 BL2Y2K1
    5 1261895 BA1M3S8 BAKA5T5
    6 1271806 BAJB7GV BA1M3S8
    7 1235427 BDZ8H4V BAJB7GV
    8 1355090 B0YTGX6 BDZ8H4V
    1 UNKSSN B0JXMSY 0
    2 1236336 BBW6RSX B0JXMSY
    3 1228220 B0SM3YK BBW6RSX
    4 1367022 BM5AYVG B0SM3YK
    when i tried the same one using max(level) like below
    select ssn,level,max(level) maxval
    from table1
    where ssn not in ( select e.ssn
    from table1 e, table2 s
    where e.ssn = s.ssn)
    group by ssn,level
    start with ssn in (select e.ssn
    from table1 e)
    connect by prior report_to=baid;
    result is :
    ORA-30928-cONNECT BY FILTERING PHASE RUNS OUT OF TEMP TABLESPACE
    Please advice, can any one give me the logic to get the max(level) value.
    Thanks

    Hi,
    The documentation implies that the START WITH and CONNECT BY clauses should come before the GROUP BY clause. I've never known it to make a difference before, but you might try putting the GROUP BY clause last.
    If you're GROUPing by LEVEL, what's the point of SELECTing MAX (LEVEL)? MAX (LEVEL) will always be the same as LEVEL.
    What are you trying to do?
    Post some sample data (CREATE TABLE and INSERT statements) and the results you want from that data, and somebody will help you get them.

  • Use of Run_product in Pl/sql block written in forms 5.0

    I am using Run_product built-in in forms 5.0 to make a call to reports runtime. This built-in is being called in a loop to make Payslip report for nearly 2000 employees.
    First of all on running the report for 9 or 10 th employee , the error was given 'MAX OPEN CURSORS EXCEEDED'. to remove this error, settings were changed in init.ora to increase Open_cursors parameter. Now the above error is not coming but after creating 8-9 reports it gives error Numeric or Value error. This error keeps coming for all the reports after that. However this error is coming in an inconsitent manner. One time it gives error for some employees but doesn't gives that error for the same employees next time.

    thanks !
    I could find out few postings on the same topic in the same forum. that answers my question.
    best regards,
    --meghanad                                                                                                                                                                                                                                                                       

  • PERFORMANCE BAD WHEN CURSORS ARE USED WITHIN PL/SQL BLOCKS

    There are poor database performance at Oracle 10g
    For some cursor selects, the performance is under Oracle 10g
    significant slower than under Oracle 9i.On a test system (Oracle 9) the
    problem does not reproduce, on the 10g system however always.
    The simple execution of the base select statement was on both
    databases in roughly of the same speed. If however a cursor was defined and
    those executed within a PL/SQL block (without involving the user interface),
    then the time behavior was in accordance with the observed behavior
    behavior on the user interface.
    By adding of the hint first_rows on both machines a
    similar (fast) time behavior can be achieved.
    Conclusion: Something in the (Optimizer) settings of the Oracle-10
    databases must be fundamentally different than that of Oracle 9. Or Oracle
    10 has a real problem. The analysis and solution of this general
    problem seems to me more reasonable than the solution of individual performance
    problems.
    can you help me, many thanks

    Hello, thanks for the explanatory notes.
    Here are the concerned Script. The only difference is the Hint (with Hint = good püerformance; without Hint = bad performance)
    DECLARE
    b BOOLEAN;
    BEGIN
    b := plogin.batch_login('**', '****', 717, FALSE);
    prost.reload_context;
    END;
    DECLARE
    l_ma_kuerzel VARCHAR2(100) DEFAULT NULL;
    l_sta_id mitarbeiter_historie.sta_id%TYPE;
    l_org_id organisationseinheit.org_id%TYPE;
    l_pv_like mitarbeiter.ma_name%TYPE;
    l_typ_id typ.typ_id%TYPE;
    l_mihi_beginn VARCHAR2(40);
    l_ma_ausgeschieden VARCHAR2(40);
    l_ma_ldap mitarbeiter.ma_ldap%TYPE;
    l_smodify_form VARCHAR2(80);
    l_sform_typ VARCHAR2(80);
    l_sheader VARCHAR2(200);
    l_nurlsource NUMBER;
    l_nurldestination prosturl.pur_id%type;
    l_ma_like VARCHAR2(100) DEFAULT NULL;
    l_nma_typ NUMBER;
    l_bshow BOOLEAN;
    l_counter NUMBER DEFAULT 0;
    cursor ma_list_not_all_detail(
    p_ma_like IN VARCHAR2 DEFAULT NULL,
    p_ma_kuerzel IN VARCHAR2 DEFAULT NULL,
    p_sta_id IN VARCHAR2 DEFAULT NULL,
    p_org_id IN VARCHAR2 DEFAULT NULL,
    p_typ_id IN VARCHAR2 DEFAULT NULL,
    p_mihi_beginn IN VARCHAR2 DEFAULT NULL,
    p_pv_like IN VARCHAR2 DEFAULT NULL,
    p_ma_ausgeschieden IN VARCHAR2 DEFAULT NULL,
    p_ma_ldap IN VARCHAR2 DEFAULT NULL
    ) IS
    SELECT /*+ first_rows */
    ma.ma_id ma_id
    , view_fkt.display_ma(mihi.typ_id_mt
    , view_fkt.cat_maname(ma.ma_name
    , ma.ma_zusatz
    , ma.ma_titel
    , ma.ma_vorname)) name
    , view_fkt.display_ma(mihi.typ_id_mt,ma.ma_kuerzel) ma_kuerzel
    , typ.typ_value mt_kuerzel
    , substr(org.typ_id,4,length(org.typ_id)) || ' ' || org.org_name||' ('||org.org_ktr||')' org_name
    , to_char(mihi.mihi_beginn, 'dd.mm.yyyy') beginn
    , decode(pv.ma_name ||' '|| pv.ma_titel ||' '|| pv.ma_vorname
    , ' ',prost_cons.t_blank
    , pv.ma_name||', '||pv.ma_titel||' '||pv.ma_vorname) pv_kuerzel
    , mihi.sta_id sta_id
    , nvl(to_char(ma.ma_ausgeschieden,'dd.mm.yyyy'), ' ') ausgeschieden
    , nvl(to_char(mihi.mihi_wochenarbeitszeit,'90D00'),' ') wochenarbeitszeit
    , nvl(to_char(mihi.mihi_taz_mo,'90D00'),' ') taz_mo
    , nvl(to_char(mihi.mihi_taz_di,'90D00'),' ') taz_di
    , nvl(to_char(mihi.mihi_taz_mi,'90D00'),' ') taz_mi
    , nvl(to_char(mihi.mihi_taz_do,'90D00'),' ') taz_do
    , nvl(to_char(mihi.mihi_taz_fr,'90D00'),' ') taz_fr
    , nvl(to_char(mihi.mihi_taz_sa,'90D00'),' ') taz_sa
    , nvl(to_char(mihi.mihi_taz_so,'90D00'),' ') taz_so
    , nvl(ma.ma_ldap, ' ') ma_ldap
    , mihi.mihi_beginn mihi_beginn
    , mihi.mihi_order_no mihi_order_no
    , mihi.mihi_order_pos mihi_order_pos
    FROM organisationseinheit org
    , typ typ
    , mitarbeiter pv
    , mitarbeiter ma
    , v$mihi_id mid
    , mitarbeiter_historie mihi
    , v$access_orgs_th_t th
    WHERE mihi.org_id = th.org_id
    AND mid.mihi_id = mihi.mihi_id
    AND ma.ma_id = mid.ma_id
    AND ma.ma_delete = 'n'
    AND ma.ma_virtualitaet = 'N'
    AND (p_ma_like IS NULL
    OR ma.ma_name LIKE p_ma_like)
    AND (p_ma_kuerzel IS NULL
    OR ma.ma_kuerzel LIKE p_ma_kuerzel)
    AND (p_sta_id IS NULL
    OR mihi.sta_id = p_sta_id)
    AND (p_org_id IS NULL
    OR org.org_id = p_org_id)
    AND (p_typ_id IS NULL
    OR typ.typ_id = p_typ_id)
    AND mihi_beginn >= nvl(p_mihi_beginn,to_date('01.01.1960','dd.mm.yyyy'))
    AND (p_pv_like IS NULL
    OR pv.ma_name LIKE p_pv_like)
    AND (ma.ma_ausgeschieden >= nvl(p_ma_ausgeschieden,to_date('01.01.1960','dd.mm.yyyy'))
    AND ma.ma_ausgeschieden - 1 < nvl(p_ma_ausgeschieden,to_date('01.01.1960','dd.mm.yyyy'))
    OR p_ma_ausgeschieden IS NULL)
    AND (p_ma_ldap IS NULL
    OR ma.ma_ldap LIKE p_ma_ldap)
    AND pv.ma_id (+)= mihi.ma_id_pv
    AND org.org_id (+)= mihi.org_id
    AND typ.typ_id = mihi.typ_id_mt
    ORDER BY upper(ma.ma_name), upper(ma.ma_vorname);
    l_result ma_list_not_all_detail%ROWTYPE;
    BEGIN
    l_nMA_Typ := pmitarbeiter.cn_Incomplete_Ma;
    l_ma_like := NULL;
    l_ma_kuerzel := NULL;
    l_sta_id := NULL;
    l_org_id := 'KST0000421301';
    l_typ_id := NULL;
    l_mihi_beginn := NULL;
    l_pv_like := NULL;
    l_ma_ausgeschieden := NULL;
    l_ma_ldap := NULL;
    IF (l_ma_like IS NOT NULL
    OR l_ma_kuerzel IS NOT NULL
    OR l_sta_id IS NOT NULL
    OR l_org_id IS NOT NULL
    OR l_typ_id IS NOT NULL
    OR l_mihi_beginn IS NOT NULL
    OR l_pv_like IS NOT NULL
    OR l_ma_ausgeschieden IS NOT NULL
    OR l_ma_ldap IS NOT NULL) THEN
    -- fuer Mitarbeiter unvollstandig wird ein andere cursor angesprochen
    -- um der Mitarbeiter vollstandig zu kriegen soll ein Standort,
    -- Arbeitszeitmodel, Bereich und Tagesarbeitszeiten ausgevult wirden
    -- Wenn er dan gespeichert wirdt wirden die betriffende velder gespeichert
    -- und wirdt das Feld Virtualiteat auf R gesetzt (war N)
    l_counter := 0;
    dbms_output.put_line(to_char(sysdate, 'sssss'));
    FOR j IN ma_List_Not_All_Detail(
    l_ma_like,
    l_ma_kuerzel,
    l_sta_id,
    l_org_id,
    l_typ_id,
    l_mihi_beginn,
    l_pv_like,
    l_ma_ausgeschieden,
    l_ma_ldap
    ) LOOP
    l_counter := l_counter + 1;
    dbms_output.put_line(l_counter);
    dbms_output.put_line(j.ma_kuerzel);
    END LOOP;
    dbms_output.put_line(to_char(sysdate, 'sssss'));
    END IF;
    return;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(sqlerrm);
    END;
    =============
    Thank you

  • Calling DBMS_STATS within PL/SQL block

    Hy guys
    I trying to call the package DBMS_STATS within a pl/sql block but I'm getting the following error..
    here is my blok
    BEGIN
    IF FGLOBAL('ABC_STATS') = 'SIM' THEN
    FOR V_OBJETOS IN C_CURSOR_STATS LOOP
    EXECUTE IMMEDIATE 'EXEC DBMS_STATS.GATHER_TABLE_STATS('''||USER||''','''||V_OBJETOS.TABLE_NAME||''')';
    END LOOP;
    END IF;
    here is the execution error
    SQL> exec analisa_stats;
    BEGIN analisa_stats; END;
    ERROR on line 1:
    ORA-00900: invalid SQL instruction
    ORA-06512: on "username.ANALISA_STATS", line 12
    ORA-06512: on line 1
    How can I call the package using execute immediate ? is there any other way ?
    Tks to All

    Hi,
    1. in pl/sql you cannot specify "exec dbms_stats ..." but only "dbms_stats ...".
    2. why execute immediate, just call dbms_stats and pass your parameters
    regards, martina

  • Write an UPdate statement using the logic used in PL/SQL block (oracle 10g)

    Hi All,
    I have written the following PL/SQL block. I want to write an UPDATE statement using the logic used in the following PL/SQL block. can any one please help me out in this regards.
    DECLARE
       v_hoov_fag   gor_gold_post.hoov_flg%TYPE;
       v_b49n          gor_gold_post.b49n%TYPE;
       CURSOR c
       IS
          SELECT bs_id, loyalty_date, loyalty_period, contract_date
            FROM gor_gold_post
           WHERE tariff_code IN (169, 135, 136);
    BEGIN
       FOR rec IN c
       LOOP
          IF    (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
                        - SYSDATE) < 304
             OR (    TRUNC (  ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
                            - SYSDATE
                           ) IS NULL
                 AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2
          THEN
             v_hoov_flg := 1;
          ELSE
             v_hoover_flag := 99;
          END IF;
          IF    (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
                        - SYSDATE) < 121.6
             OR (    TRUNC (  ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
                            - SYSDATE
                           ) IS NULL
                 AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2
          THEN
             v_b49n := 1;
          ELSE
             v_b49n := 99;
          END IF;
          UPDATE gor_gold_post
             SET hoov_flg = v_hoov_flg,
                 b49n = v_b49n
           WHERE bs_id = rec.bs_id AND tariff_code IN (169, 135, 136);
          COMMIT;
       END LOOP;
    END;Thank you,

    Using case statement.
    UPDATE gor_gold_post
       SET hoov_flag = CASE WHEN TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) < 304
                                   OR
                                   (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) IS NULL
                                AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2)
                           THEN 1
                           ELSE 99
                         END,
           b49n      = CASE WHEN TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) < 121.6
                             OR
                             (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) IS NULL
                                AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2)
                           THEN 1
                           ELSE 99
                         END
    WHERE tariff_code IN (169, 135, 136);Note: Code not tested.

  • Pl/sql block reading reading table data from single point in time

    I am trying to figure out whether several cursors within a PL/SQL block are executed from within a Single Point In Time, and thus do not see any updates to tables made by other processes or procedures running at the same time.
    The reason I am asking is since I have a block of code making some data extraction, with some initial Sanity Checks before the code executes. However, if some other procedure would be modifying the data in between, then the Sanity Check is invalid. So I am basically trying to figure out if there is some read consistency within a PL/SQL, preventing updates from other processes to be seen.
    Anyone having an idea?.
    BR,
    Cenk

    "Transaction-Level Read Consistency
    Oracle also offers the option of enforcing transaction-level read consistency. When a transaction runs in serializable mode, all data accesses reflect the state of the database as of the time the transaction began. *This means that the data seen by all queries within the same transaction is consistent with respect to a single point in time, except that queries made by a serializable transaction do see changes made by the transaction itself*. Transaction-level read consistency produces repeatable reads and does not expose a query to phantoms."
    http://www.oracle.com/pls/db102/search?remark=quick_search&word=read+consistency&tab_id=&format=ranked

  • Spooling from PL/SQL Block

    Hi,
    Is it possible to do spooling from a pl/sql block.The spool cannot be the first command because I want to give the spool file name in a loop and each time the spool name should change based on the value.
    I tried all possiblities,but I couldn't can anyone give me some idea on how to do this.
    I cannot use UTL_FILE option ,because the client agreed only for spooling.
    Is it possible to write the spool data is excel format..
    Please find below an example of my requirement..
    DECLARE
    CurSor Cur_Designation IS
    Select Designation from tbl_Designation;
    N_Desig Cur_Designation%RowType;
    Cursor Cur_Emp(Desig Number) IS
    Select Emp_no,Emp_name
    From Employee Where Emp_Designation = Desig;
    N_Emp Cur_Emp%RowType;
    BEGIN
    Open Cur_Designation ;
    Loop
    Fetch Cur_Designation INTO N_Desig;
    EXIT WHEN Cur_Designation %NOTFOUND;
    --Here I want to give the spool file name
    Spool --Should be designation name
    Open Cur_Emp(N_Desig.Designation);
    Loop
    Fetch Cur_Emp INTO N_Emp ;
    EXIT WHEN Cur_Emp %NOTFOUND;
    -- All employee details I need to come to log file
    End Loop;
    Close Cur_Emp;
    End Loop;
    Close Cur_Desingnation;
    End;
    Please advice me how to do this..
    Thanks,
    Bindu

    << I cannot use UTL_FILE option ,because the client agreed only for spooling. >>
    << I want to use it in a PL/SQL Block.I have some variables to declare and some cursors to be used.
    So where should I use the spool command.
    I tried to given after a fetch command ,but it is not working. >>
    you can't use SPOOL inside PLSQL
    you may use dbms_output calls in PLSQL
    so create a procedure test2 instead of sqlscript test2 and you will be fine
    rem =========== procedure test2 ================
    create or replace
    procedure test2 (p_param number) is
    begin
                 dbms_output.enable (1000000);
                 dbms_output.put_line('A' || chr(9) || 'B' || chr(9) || 'C' ) ;
                 FOR i_rec in (select a,b.c from xyz where a = p_param) LOOP
                     dbms_output.put_line (to_char(a) || chr(9) || b || chr(9) || c ) ;
                 END LOOP ;
    end ;
    REM ====================================================                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Stored Procedure Vs PL-SQL Block

    Hi,
    I came across an interesting problem last week. Fortunately, I was able to solve it or find an acceptable workaround for myself. But wanted to get some clarification from the experts. So posting it here.
    Also, I am new to Orcle, so please excuse any shortcomings in the post.
    My data model has following tables-
    TABLE_PARENT (ID, other columns)
    TABLE_CHILD (ID, other columns, PARENT_ID_FK)
    Here, ID is the primary key column for the respective tables; PARENT_ID_FK is the foreign key referencing the ID column from the TABLE_PARENT.
    I created a stored procedure programmatically (using MS Excel) to insert records in the two tables. The stored procedure has insert statements for an indefinite number of records in the parent table and for every such record, there's a corresponding record inserted in the child table. Here's the sample code.
    BEGIN
    /*first record*/
    parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
    INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
    INSERT INTO TABLE_CHILD(ID, other values,parent_id );
    /*second record*/
    parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
    INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
    INSERT INTO TABLE_CHILD(ID, other values,parent_id );
    /*third record*/
    parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
    INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
    INSERT INTO TABLE_CHILD(ID, other values,parent_id );
    /*and so on*/
    END
    When I run this stored procedure, I keep getting following exception intermittently-
    ORA-02291: integrity constraint violated-parent key not found tips.
    My thinking is that it comes because the insert statements are executing ahead of turn of the parent_id assignment statement. And this is happening possibly because of some parallelism that is taking place during the execution of the stored procedure, or, some sort of optmization that the DB server does (though erroneously) when it compiles the stored procedure.
    I tried out everything that I could think of but it didn't go away. Finally, when I executed the same set of statements as a PL-SQL block, it worked fine.
    To understand it better, I am looking for clarification on the following questions.
    1) Why does the exception come with stored procedure but not with PL-SQL block? Is my reasoning given above correct (parallelism or some sort of optimization coming into play)?
    2) If it is due to parallelism, how to run a Oracle stored procedure with defree of prallelism set to 1?
    3) If it is due to optimization done by the compiler, how to instruct the compiler to not do any such optimization. Also, in any case, isn't it an error to optimize but lose program semantics?
    4) Another question related to the same piece of work I have is to use transactions in the PL-SQL block, I had to explicitly COMMIT/ROLLBACK it in the code. In whatever references I had read, it was said that by default the transaction begins with BEGIN statement and commits with END. Also, it seems to work with a Stored Proedure though. So is it that a PL_SQL block needs explicity call to COMMIT/ROLLBACK to achive transactions but stored procedures do not?
    Any inputs/clarifications will be much appreciated.
    Thank you
    Neelesh

    Ok, your last couple of paragraphs were helpful. Here're the details that were missing in my earlier post.
    - I am on Oracle 10.2.0.
    - Table definitions-
    CREATE TABLE "MYUSER"."TABLE_PARENT"
    *(     "ID" NUMBER(19,0) NOT NULL ENABLE,*
    *     "NAME" VARCHAR2(30),*
    *     "DESCRIPTION" VARCHAR2(80),*
    *     "RULETYPE" NUMBER(10,0) NOT NULL ENABLE,*
    *     "OPERATOR" NUMBER(10,0),*
    *     "MININTERCEPT" FLOAT(126),*
    *     "PRIORITY" NUMBER(10,0),*
    *     "PENALTY" NUMBER(10,0),*
    *     "STATUS" NUMBER(10,0),*
    *     PRIMARY KEY ("ID")*
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"  ENABLE,
    *) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING*
    STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    CREATE TABLE "MYUSER"."TABLE_CHILD"
    *(     "ID" NUMBER(19,0) NOT NULL ENABLE,*
    *     "WEIGHT" NUMBER(19,0),*
    *     "PARENTID_FK" NUMBER(19,0),*
    *     PRIMARY KEY ("ID")*
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"  ENABLE,
    *     CONSTRAINT "FK3A78BF1E6A9DCE51" FOREIGN KEY ("PARENTID_FK")*
    *     REFERENCES "MYUSER"."TABLE_PARENT" ("ID") ENABLE*
    *) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING*
    STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    - The Stored procedure definition is-
    CREATE OR REPLACE PROCEDURE LOAD_RULES_SP AS
    ruleid NUMBER(19,0);
    tempid NUMBER(19,0);
    BEGIN
    */* First parent record */*
    SELECT IDGENERATOR.NEXTVAL INTO ruleid FROM dual;
    INSERT INTO TABLE_PARENT (ID, NAME, DESCRIPTION, RULETYPE, OPERATOR, MININTERCEPT, PRIORITY, penalty, STATUS) VALUES (ruleid, 'Rule 1',null,3,0,0,null,null,1);
    */* Corresponding child records */*
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.2, ruleid);
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.5, ruleid);
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.3, ruleid);
    */* First parent record */*
    SELECT IDGENERATOR.NEXTVAL INTO ruleid FROM dual;
    INSERT INTO TABLE_PARENT (ID, NAME, DESCRIPTION, RULETYPE, OPERATOR, MININTERCEPT, PRIORITY, penalty, STATUS) VALUES (ruleid, 'Rule 1',null,3,0,0,null,null,1);
    */* Corresponding child records */*
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.2, ruleid);
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.5, ruleid);
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.3, ruleid);
    */* And so on for a few parent records more */*
    END;
    Can you throw some light on the exception I was seeing now? Note that when I changed from stored procedure to an anonymous block, it worked fine.
    One correction in my earlier post is that as the code snippet shows, there are multiple inserts in the child table for every record inserted in the parent one.

Maybe you are looking for

  • Input values in the result area

    Hi Bw gurus, Could you plz tell me to eliminate the Input values displayed between the Navigation block and the Result area. I mean if we give some input range in the variable screen the range(Input)values are displayed in the Result area.Also if we

  • Best method for secure Internet ?????

    OK, So I wasn't sure where to put this post, so I figured I would start with the system I am using and go from there. The Problem: I am trying to set up a secure method in which I can use Internet services as I make my way from non-secure places thro

  • Rotate view drifts over

    I recently upgraded to cs6, and now when I use the rotate view tool the center of rotation drifts down and to the right as I rotate. It continues to drift until it reaches the bottom and then it jumps to the top and continues down again. This is real

  • Copy data between productive and test system

    Hi everybody, I need to copy data from one cube in productive system into the same cube in the test system. How can I do it? Regards Erwin

  • Commande CS6 version étudiant et enseignant

    Bonjour, Depuis environ une semaine, j'essaie de commander CS6 enseignant/étudiant. Quatre jours après l'envoi des justificatifs, la réception d'un message émis par un certain M. Ricardo Peetermans, du service clientèle Adobe, stipulant que ces docum