Weired behaviour while we compile PL/SQL package

Hi All,
We have one package where we have declared few constants those we are using all over our application code. By mistake, one of the developer declared one constant twice, we didn't notice it until today while chasing down a bug...
I was under impression that we can not declare same variable or constants twice in the same package/procedure/block. But surprisingly, if we are not using the same variable in that block, (We defined it global packaged constant) we are not getting compilation error or warning. Does anyone know anything about this.
Oracle Configuration:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - ProductionThanks in advance.
Thanks,
Dharmesh Patel

I would again point out that I do not see the results as you describe. see the output from 9.2.0.3 below. Both times it gives me the same result.
As shown above by James, it throws out the correct error under 10G. But as far as I see, it seems to be consistent under Oracle9i release 9.2.0.3 and 9.2.0.5.
I think it might be the time for your database to be upgraded to at least 9.2.0.3 release.
SQL> CREATE OR REPLACE PACKAGE P00_Constants AS
  2      SubType201 CONSTANT VARCHAR2(3) := '201';
  3      SubType202 CONSTANT VARCHAR2(3) := '202';
  4      SubType202A CONSTANT VARCHAR2(4) := '202A';
  5      SubType202P CONSTANT VARCHAR2(4) := '202P';
  6      SubType202I CONSTANT VARCHAR2(4) := '202I';
  7      SubType203 CONSTANT VARCHAR2(3) := '203';
  8      SubType201 CONSTANT VARCHAR2(3) := '204';
  9
10      Yesflag CONSTANT VARCHAR2(3) := 'YES';
11      ------------------------------------------------------
12
13      --- <summary>This function returns value of YES</summary>
14      --- <param name="none"></param>
15      --- <exception cref="none"> </exception>
16      FUNCTION GetyesFlag RETURN VARCHAR2;
17      PRAGMA RESTRICT_REFERENCES(GetYesFlag,
18                                 WNDS,
19                                 WNPS);
20  END P00_Constants;
21  /
Package created.
SQL> SHOW ERRORS
No errors.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY P00_Constants AS
  2      ---function getYesFlag
  3      FUNCTION GetYesFlag RETURN VARCHAR2 IS
  4      BEGIN
  5          RETURN YesFlag;
  6      END;
  7  END P00_Constants;
  8  /
Package body created.
SQL> SHOW ERRORS
No errors.
SQL>
SQL> CREATE OR REPLACE PACKAGE Test_Constant IS
  2      -- Author  : DPATEL
  3      -- Created : 10/12/2004 8:20:12 AM
  4      -- Purpose : To test the duplicate constants defined in P00_Constants package
  5      -- Public type declarations
  6      FUNCTION getSubType RETURN VARCHAR2;
  7  END Test_Constant;
  8  /
Package created.
SQL> SHOW ERRORS
No errors.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY Test_Constant IS
  2      FUNCTION getSubType RETURN VARCHAR2 IS
  3          mySubType VARCHAR2(10);
  4      BEGIN
  5          mySubType := P00_Constants.SubType201;
  6          RETURN(mySubType);
  7      END;
  8  END Test_Constant;
  9  /
Package body created.
SQL> SHOW ERRORS
No errors.
SQL>
SQL> -- Test Script
SQL> SET SERVEROUTPUT ON
SQL> BEGIN
  2      Dbms_OutPut.Put_Line('Result is: ' || test_constant.getsubtype);
  3  END;
  4  /
Result is: 204
PL/SQL procedure successfully completed.
SQL> ALTER PACKAGE P00_Constants COMPILE
  2  /
Package altered.
SQL> SET SERVEROUTPUT ON
SQL> BEGIN
  2      Dbms_OutPut.Put_Line('Result is: ' || test_constant.getsubtype);
  3  END;
  4  /
Result is: 204
PL/SQL procedure successfully completed.
SQL>
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.3.0 - Production
SQL>

Similar Messages

  • Connection Reset when compiling PL/SQL Package

    Recently a strange issue appeared on my office PC. When I try To compile a PL/SQL package on specific Oracle instance I get an error message:
    Error: Io exception: Connection reset by peer: socket write error
    And the connection is reset. I even cannot reconnect to database schema. To open connection again I have to restart SQL Developer. In spite of this issue I can execute SELECT queries in SQL worksheet and view data in tables. Error message appears only when compiling packages in any schema on database instance in our local network and only on my PC. Other office PCs works fine without any errors. I am able to compile packages on remote database from my PC.
    Same error message shows up in different SQL Developer versions and also in JDeveloper. SQL Developer restart, Windows restart, database instance restart doesn't help.
    Used software:
    SQL Developer versions: 1.2.1 and 1.1
    JDeveloper version: 10.1.3.2
    Oracle Database on local network: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
    Remote Oracle Database: Oracle Database 10g Release 10.2.0.3.0 - Production
    OS: Windows XP Pro SP2
    Thanks,
    Raymond

    I am trying to convert the values in a selected
    column into 1 and 0 so that I can display all 1s in
    one column, all 0s in another. I am doing this in a
    PL/SQL package. However ORACLE compiler does not
    like the CASE construct.
    Does anyone know how to group values in a column into
    several new columns. If CASE WHEN construct is not
    doable in PL/SQL, what alternatives are there?
    Thanks.
    CURSOR v_Cursor IS
    SELECT A.D_CODE, A.M_CODE, TEST_START ,
    , C.C_NAME,C.P_ID,
    SUM(CASE WHEN MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 >
    40 AND MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 <85 ANDB.B_CODE IN '11.1','222.2','272.4') THEN 1 ELSE 0
    END) QUALIFIEDUse the Decode function. This has been around in oracle SQL for ages and works like a case construct.
    You would do something like
    select ...
    sum( decode (MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 >
    40 AND MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 <85 AND
    B.B_CODE IN ('11.1','222.2','272.4') 1,0 )

  • Compiling pl/sql packages via sql

    Hi All,
    Is it possible to compile the pl/sql packages via sql scripts or shell scripts
    The idea is to make the compilation process independent of tools like PL/SQL developer and people.
    Thanks in adv.
    Bh.

    OK. What sort of source control system are you using?
    In general, you would want to check in all your scripts to a version control system and write scripts that automatically check the appropriate version of a script out of source control and apply it to the appropriate environment in the appropriate order at the appropriate time. What is appropriate, obviously, is going to be heavily influenced by your particular environment, needs, build process, build schedule, etc.
    One possibility is to check in a MASTER_BUILD.sql script that is a SQL*Plus script that invokes whatever other scripts are necessary for a particular change, along with all the supporting scripts, into a folder that is at whatever granularity you track changes. Your build process would then just check out everything in this folder and run MASTER_BUILD.
    Justin

  • Native Compiled PL/SQL on WindowsXP (Visual Studio)

    Has anyone tried to native compile PL/SQL packages on Windows XP using Visual Studio?
    Please give me your values for PLSQL* initialization parameters and a makefile that works.
    /Hakan

    Hi,
    Sorry to bump this thread, but I would like to validate something.
    Is it possible, or does it make sens, to have a database that has both native and interpreted?
    Our PLSQL_CODE_TYPE is set to interpreted but everthing else is configured for native.
    When i do the bellow query:
    select type, plsql_code_type, count(*)
    from dba_plsql_object_settings
    where plsql_code_type is not null
    group by type, plsql_code_type
    order by type, plsql_code_type
    We have bunch of functions in native/interpreted, same thing for package, package body, procedure, trigger, type, type body.
    Thank you,
    Felix

  • Exiting from sqlplus when there is any errors while compiling pl/sql progra

    I am connecting to sqlplus from unix and I am executing a pl/sql script . Now if I get some error while compiling a procedure, package, function or any sql statement I want to exit sqlplus.
    whenever sqlerror works only for sql statements but not for plsql
    I dont want to query user_errors table and then throw some exception depending on the same .
    Is there any command available or any easier way to solve this problem ?

    Those errors we get only when there is conflict in same etc.
    Now consider the example here
    sample.sql
    whenever sqlerror exit failure ;
    declare
            s1 long;
    begin
            s1 := 'create or replace procedure proc1 as '||
              'declare '||
              'begin '||
                  'end; '||
              'end;';
            execute immediate s1;
    end;
    select 1 from dual;When I run the script
    SQL> @sample.sql
    ERROR:
    ORA-24344: success with compilation error
    ORA-06512: at line 9
    Warning: PL/SQL compilation errors.
             1
             1Actually I want to get out before it executes select means once it throws error in pl/sql.

  • SQL*Plus crash due to PL/SQL package compilation

    The problem:
    SQL*Plus crash due to creation large PL/SQL with windows dump error.
    But if insert that package using for example ToAD it works fine.
    The solution:
    I have increased processes parameter in spfile from 40 up to 400. I think it is no need to increase the parameter to such large value, but this value is works.

    emss wrote:
    Can a .sql sql*plus script be called from a pl/sql package? I so, can someone provide a brief example?Not really - there is no easy interface.
    There are interfaces that are not easy. You could instead
    * use DBMS_SCHEDULER to create a host call to execute an OS script to execute the SQL*PLUS script
    * use a java stored procedure to do the same thing
    Do a web search to find examples

  • Using CASE WHEN in PL/SQL package

    I am trying to convert the values in a selected column into 1 and 0 so that I can display all 1s in one column, all 0s in another. I am doing this in a PL/SQL package. However ORACLE compiler does not like the CASE construct.
    Does anyone know how to group values in a column into several new columns. If CASE WHEN construct is not doable in PL/SQL, what alternatives are there? Thanks.
    /******* My package starts here *******/
    CREATE OR REPLACE PACKAGE TEST_NEED AS
    PROCEDURE procTEST_NEED(STARTING_DATE IN VARCHAR2);
    END CVRR_MON_NEED;
    CREATE OR REPLACE PACKAGE BODY TEST_NEED
    AS
    PROCEDURE procTEST_NEED(STARTING_DATE IN VARCHAR2)
    IS
    TEST_START DATE := TO_DATE(STARTING_DATE,'MM/DD/YYYY');
    CURSOR v_Cursor IS
    SELECT A.D_CODE, A.M_CODE, TEST_START , C.C_NAME,C.P_ID,
    SUM(CASE WHEN MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 > 40 AND MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 <85 AND B.B_CODE IN '11.1','222.2','272.4') THEN 1 ELSE 0 END) QUALIFIED
    FROM A, B, C, D
    WHERE A.ID = B.B_ID
    AND RTRIM(A.P_CODE) = C.P_CODE
    AND A.P_ID = D.P_ID
    AND A.P_ID < 99999999999999999999
    AND A.E_DATETIME < SYSDATE
    GROUP BY A.D_CODE, A.M_CODE, TEST_START , C.C_NAME,C.P_ID;
    v_RecordHolder v_Cursor%ROWTYPE;
    BEGIN
    OPEN v_Cursor;
    FETCH v_CursorINTO v_RecordHolder ;
    WHILE v_Cursor%FOUND LOOP
    look for records in another table with matching keys of the cursor
    if found then update by incrementing the existing values in the matching records with values of the current currsor row
    else insert the current cursor row
    FETCH v_Cursor INTO v_RecordHolder ;
    END LOOP;
    END procTEST_NEED;
    END TEST_NEED;

    I am trying to convert the values in a selected
    column into 1 and 0 so that I can display all 1s in
    one column, all 0s in another. I am doing this in a
    PL/SQL package. However ORACLE compiler does not
    like the CASE construct.
    Does anyone know how to group values in a column into
    several new columns. If CASE WHEN construct is not
    doable in PL/SQL, what alternatives are there?
    Thanks.
    CURSOR v_Cursor IS
    SELECT A.D_CODE, A.M_CODE, TEST_START ,
    , C.C_NAME,C.P_ID,
    SUM(CASE WHEN MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 >
    40 AND MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 <85 ANDB.B_CODE IN '11.1','222.2','272.4') THEN 1 ELSE 0
    END) QUALIFIEDUse the Decode function. This has been around in oracle SQL for ages and works like a case construct.
    You would do something like
    select ...
    sum( decode (MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 >
    40 AND MONTHS_BETWEEN(SYSDATE, D.P_DOB)/12 <85 AND
    B.B_CODE IN ('11.1','222.2','272.4') 1,0 )

  • Compile debug causes package to become invalid

    We're running 10.2.0.4.0 and I have a large package (7730 lines) which compiles fine on it's own. However, if I try to enable debug mode, I get an error:
    SQL> alter package mypkg compile debug package;
    Warning: Package altered with compilation errors.
    SQL> show errors;
    No errors.
    If I perform another alter command without the debug parameter, then it compiles fine:
    SQL> alter package mypkg compile package;
    Package altered.
    Also, if I compile this package using the "Compile for Debug" button in SQL Developer then I actually get an error message:
    Error(1): PLS-00707: unsupported construct or internal error [2603]
    Does anyone have any idea what's going on here? I've spent the past couple days searching for a solution and while I've seen many cases of people having the PLS-00707 error, I wasn't able to find anyone who only receives it when compiling for debug.

    SQL> CONN SCOTT
    Connected.
    SQL> SELECT * fROM V$VERSION;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    PL/SQL Release 9.2.0.1.0 - Production
    CORE 9.2.0.1.0 Production
    TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
    NLSRTL Version 9.2.0.1.0 - Production
    SQL> ALTER PACKAGE P1 COMPILE DEBUG;
    Package altered.
    SQL> alter session set events='10938 trace name context level 14';
    Session altered.
    SQL> SELECT P1.ADD_NUM(5,6) FROM DUAL;
    SELECT P1.ADD_NUM(5,6) FROM DUAL
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    SQL> SELECT NAME FROM V$DATABASE;
    SELECT NAME FROM V$DATABASE
    ERROR at line 1:
    ORA-03114: not connected to ORACLE
    SQL> SELECT SYSDATE FROM DUAL;
    SELECT SYSDATE FROM DUAL
    ERROR at line 1:
    ORA-03114: not connected to ORACLE
    can one tell me how to solve this problem? thanks in advance.

  • Are PL/SQL Package Body Constants in Shared Area or Private Area

    Based on this it not clear to me if PL/SQL Package Body Constants are stored in shared area or private area.
    http://docs.oracle.com/cd/B28359_01/server.111/b28318/memory.htm
    "PL/SQL Program Units and the Shared Pool
    Oracle Database processes PL/SQL program units (procedures, functions, packages, anonymous blocks, and database triggers) much the same way it processes individual SQL statements. Oracle Database allocates a shared area to hold the parsed, compiled form of a program unit. Oracle Database allocates a private area to hold values specific to the session that runs the program unit, including local, global, and package variables (also known as package instantiation) and buffers for executing SQL. If more than one user runs the same program unit, then a single, shared area is used by all users, while each user maintains a separate copy of his or her private SQL area, holding values specific to his or her session.
    Individual SQL statements contained within a PL/SQL program unit are processed as described in the previous sections. Despite their origins within a PL/SQL program unit, these SQL statements use a shared area to hold their parsed representations and a private area for each session that runs the statement."
    I am also curious what are the fine grained differences from a memory and performance perspective (multi-session) for the two examples below. Is one more efficient?
    Example 1.
    create or replace
    package body
    application_util
    as
    c_create_metadata constant varchar2(6000) := ...
    procedure process_xxx
    as
    begin
    end process_xxx;
    end application_util;
    vs.
    Example 2.
    create or replace
    package body
    application_util
    as
    procedure process_xxx
    as
    c_create_metadata constant varchar2(6000) := ...
    begin
    end process_xxx;
    end application_util;

    >
    What i am asking is fairly granular, so here it is again, let's assume latest version of oracle..
    In a general sense, is the runtime process able to manage memory more effectively in either case, one even slightly more performant, etc
    ie does example 1 have different memory management characteristics than example 2.
    Specifically i am talking about the memory allocation and unallocation for the constant varchar2(6000)
    Ok, a compiler's purpose is basically to create an optimized execution path from source code.
    The constant varchar2(6000) := would exist somewhere in the parse tree/execution path (this is stored in the shared area?).
    I guess among the things i'm after is
    1) does each session use space needed for an additional varchar2(6000) or does runtime processor simply point to the constant string in the parse tree (compiled form which is shared).
    2) if each session requires allocation of space needed for an additional varchar2(6000), then for example 1 and example 2
    at what point does the constant varchar allocation take place and when is the memory unallocated.
    Basically does defining the constant within the procedure have different memory characteristics than defining the constant at the package body level?
    >
    Each 'block' or 'subprogram' has a different scope. So the 'constant' defined in your example1 is 'different' (and has a different scope) than the 'constant' defined in example2.
    Those are two DIFFERENT objects. The value of the 'constant' is NOT assigned until control passes to that block.
    See the PL/SQL Language doc
    http://docs.oracle.com/cd/E14072_01/appdev.112/e10472/fundamentals.htm#BEIJHGDF
    >
    Initial Values of Variables and Constants
    In a variable declaration, the initial value is optional (the default is NULL). In a constant declaration, the initial value is required (and the constant can never have a different value).
    The initial value is assigned to the variable or constant every time control passes to the block or subprogram that contains the declaration. If the declaration is in a package specification, the initial value is assigned to the variable or constant once for each session (whether the variable or constant is public or private).
    >
    Perhaps this example code will show you why, especially for the second example, a 'constant' is not necessarily CONSTANT. ;)
    Here is the package spec and body
    create or replace package pk_test as
      spec_user varchar2(6000);
      spec_constant varchar2(6000) := 'dummy constant';
      spec_constant1 constant varchar2(6000) := 'first constant';
      spec_constant2 constant varchar2(6000) := 'this is the second constant';
      spec_constant3 constant varchar2(6000) := spec_constant;
      procedure process_xxx;
      procedure change_constant;
    end pk_test;
    create or replace package body pk_test as
    procedure process_xxx
    as
      c_create_metadata constant varchar2(6000) := spec_constant;
    begin
      dbms_output.put_line('constant value is [' || c_create_metadata || '].');
    end process_xxx;
    procedure change_constant
    as
    begin
      spec_constant := spec_constant2;
    end change_constant;
    begin
      dbms_output.enable;
      select user into spec_user from dual;
      spec_constant := 'User is ' || spec_user || '.';
    end pk_test;The package init code sets the value of a packge variable (that is NOT a constant) based on the session USER (last code line in package body).
    The 'process_xxx' procedure gets the value of it's 'constant from that 'non constant' package variable.
      c_create_metadata constant varchar2(6000) := spec_constant;The 'change_constant' procedure changes the value of the package variable used as the source of the 'process_xxx' constant.
    Now the fun part.
    execute the 'process_xxx' procedure as user SCOTT.
    SQL> exec pk_test.process_xxx;
    constant value is [User is SCOTT.].Now execute 'process_xxx' as another user
    SQL> exec pk_test.process_xxx;
    constant value is [User is HR.].Now exec the 'change_constant' procedure.
    Now exec the 'process_xxx' procedure as user SCOTT again.
    SQL> exec pk_test.process_xxx;
    constant value is [this is the second constant].That 'constant' defined in the 'process_xxx' procedure IS NOT CONSTANT; it now has a DIFFERENT VALUE.
    If you exec the procedure as user HR it will still show the HR constant value.
    That should convince you that each session has its own set of 'constant' values and so does each block.
    Actually the bigger memory issue is the one you didn't ask about: varchar2(6000)
    Because you declared that using a value of 6,000 (which is 2 ,000 or more) the actual memory allocation not done until RUN TIME and will only use the actual amount of memory needed.
    That is, it WILL NOT pre-allocate 6000 bytes. See the same doc
    http://docs.oracle.com/cd/E14072_01/appdev.112/e10472/datatypes.htm#CJAEDAEA
    >
    Memory Allocation for Character Variables
    For a CHAR variable, or for a VARCHAR2 variable whose maximum size is less than 2,000 bytes, PL/SQL allocates enough memory for the maximum size at compile time. For a VARCHAR2 whose maximum size is 2,000 bytes or more, PL/SQL allocates enough memory to store the actual value at run time. In this way, PL/SQL optimizes smaller VARCHAR2 variables for performance and larger ones for efficient memory use.
    For example, if you assign the same 500-byte value to VARCHAR2(1999 BYTE) and VARCHAR2(2000 BYTE) variables, PL/SQL allocates 1999 bytes for the former variable at compile time and 500 bytes for the latter variable at run time.
    >
    So when you have variables and don't know how much space is really needed do NOT do this:
    myVar1 VARCHAR2(1000);
    myVar2 VARCHAR2(1000);
    myVar3 VARCHAR2(1000);The above WILL allocate 3000 bytes of expensive memory even if it those variables are NEVER used.
    This may look worse but, as the doc states, it won't really allocate anything if those variables are not used. And when they are used it will only use what is needed.
    myVar1 VARCHAR2(2000);
    myVar2 VARCHAR2(2000);
    myVar3 VARCHAR2(2000);

  • Forms 6i (Error while form compilation)

    Hi,
    Inspite of having all the listed .pll files in the tools/open60/plsqllib folder of oracle forms home, whenevr I open my form thru oracle form builder, I get the following error message:
    FRM-10102: Cannot attach PL/SQL library INVTLSAT. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library INVSMODL. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library INVSLENT. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library APPDAYPK. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library APPCORE. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library VERT. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library PSAC. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library IGILUTIL. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library IGILUTIL2. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library IGI_CC. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library IGI_IAC. This library attachment will be lost if the module is saved.
    FRM-10102: Cannot attach PL/SQL library CUSTOM. This library attachment will be lost if the module is saved.
    After attaching them manually, am able to compile it through the forms builder, but on the unix box, i get the follwing errors in app_custom(standard package):
    Compiling package body APP_CUSTOM...
    Compilation error on package body APP_CUSTOM:
    PL/SQL ERROR 302 at line 22, column 19
    component 'DISABLED' must be declared
    PL/SQL ERROR 0 at line 22, column 5
    Statement ignored
    PL/SQL ERROR 201 at line 40, column 5
    identifier 'APP_WINDOW.CLOSE_FIRST_WINDOW' must be declared
    PL/SQL ERROR 0 at line 40, column 5
    Statement ignored
    -----------------

    Hi ,
    This question needs to be posted in the Oracle E-business suite Forum so that you will get some replies.
    But anyway I will try, Check all the related .pll and .plx are in the $AU_TOP/bin directory,maybe that is the issue
    also while opening or loading the form/libarary , it will ask whether to keep the path or not , select option"no" so that when you put back the forms( after compliation) into the server you will not run into issue , else you will be having issues if you put the form in the server ( eg Unix/linux to the correspong top eg $AR_TOP/forms/US).

  • Creating PL/SQL packages

    Hello,
    The problem I am confronted with is reusing generated models.
    In the process of DataMinig several steps are used: prepare data, Attribute selection (using AI), and building, testing and applying models.
    If PL/SQL packages are used two problems occur:
    First: Long, hand driven process of building:
    Model generation in ODM,
    PL/SQL package building in ODM and Export to SQL file,
    importing package to DB, compiling and running.
    I am sorry, but I don't understand why is it necessary to export PL/SQL packages in a file? As if these products aren't both Oracle products?
    Second: If data (in time) changes and AI selects new attributes, then all next steps fail, since column names, and even some values, are hard coded! Therefore it is necessary to go trough the build and export process all over again. This really hurts.
    Do you have a suggestion how to get around this problem?
    I already considered using a SPSS Clementine, but since it is not an Oracle product I still believe, the original Oracle solution should give me some advantages.
    Oh and another issue.
    I tried using PL/SQL generator (Ver.: 10.1.3.0.17) in JDeveloper (ver.: 10.1.3.0.4), but it gave me an error:
    java.lang.NoClassDefFoundError: oracle/dmt/dm4j/DM4JConnectionManager
         at oracle.dmt.dm4j.extension.CodeGenerator.invoke(Unknown Source)
         at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:310)
         at oracle.ide.wizard.WizardManager$2.run(WizardManager.java:358)
         at oracle.ide.util.IdeUtil.invokeAfterRepaint(IdeUtil.java:1093)
         at oracle.ide.wizard.WizardManager$1.run(WizardManager.java:366)
         at oracle.ide.util.IdeUtil$1$1.run(IdeUtil.java:1073)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Thanks for the reply,
    Igor

    Hi,
    The code generation available in ODMr would allow you to deploy the build, apply or test process as generated code.
    I am not sure what your application goal is, but if you simply want to deploy a model be used in an apply process that is rather straight forward.
    You would build the model using ODMr. Then create an Apply Activity, again using ODMr.
    The Apply Activity can then be used to generate code (pl/sql) using the JDev RTM release (10.1.3.2 or above). We will also have a version that will work with SQLDev shortly.
    The generated code is immediately placed into the db for you.
    If you want to score in a separate db you can either create a db link from that db or move both the model and the apply pl/sql code to the new db (using dba utilities).
    If you want to rebuild a model, where you would add/remove attributes, change transformations etc. then you will have to regenerate the code.
    If you simply want to rebuild the model without changing any transformations and settings you could also deploy the model build generated code.
    As for the JDev failure, we are going to look into that. Have you tried the JDev 10.1.3.3 release available on the Oracle web site?
    Thanks, Mark

  • Creating a webservice from PL/SQL Package in JDev 11g

    Hi All...
    I have a PL/SQl package and I am using JDEv 11g. I want to create it as a webservice. I want to deploy it in a remote server. Can I deploy it from my client machine. In server Weblogic already started. What are the prerequisites, that we need to deploy a wbservice. I done the following steps.
    1. Create an application.
    2. Right click the package and select Generate Java option.
    3. It create a Java class in the Application sources.
    4. Double click the class and select Create Web Service. It created the web service.
    5. When I select the webservice and click Run it shows the following error. It going to the Default \server. Actually I need it in a remote server.
    [Running application NewWebService on Server Instance DefaultServer...]
    ---- Deployment started. ---- Apr 20, 2009 1:15:40 PM
    Target platform is (Weblogic 10.3).
    Running dependency analysis...
    2009-04-20 13:15:40.205: Writing WAR file to D:\Oracle\Middleware\jdeveloper\system\system11.1.1.0.31.51.88\o.j2ee\drs\NewWebService\NewWebService-LastNoWebService-webapp
    2009-04-20 13:15:40.222: Wrote WAR file to D:\Oracle\Middleware\jdeveloper\system\system11.1.1.0.31.51.88\o.j2ee\drs\NewWebService\NewWebService-LastNoWebService-webapp
    2009-04-20 13:15:40.357: Writing EAR file to D:\Oracle\Middleware\jdeveloper\system\system11.1.1.0.31.51.88\o.j2ee\drs\NewWebService
    2009-04-20 13:15:40.374: Wrote EAR file to D:\Oracle\Middleware\jdeveloper\system\system11.1.1.0.31.51.88\o.j2ee\drs\NewWebService
    Deploying Application...
    <Apr 20, 2009 1:15:40 PM IST> <Warning> <J2EE> <BEA-160195> <The application version lifecycle event listener oracle.security.jps.wls.listeners.JpsAppVersionLifecycleListener is ignored because the application NewWebService is not versioned.>
    <Apr 20, 2009 1:15:40 PM IST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1240213540593' for task '3'. Error is: 'java.lang.ClassNotFoundException: sqlj.runtime.ref.DefaultContext'
    java.lang.ClassNotFoundException: sqlj.runtime.ref.DefaultContext
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         Truncated. see log file for complete stacktrace
    java.lang.ClassNotFoundException: sqlj.runtime.ref.DefaultContext
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         Truncated. see log file for complete stacktrace
    >
    <Apr 20, 2009 1:15:40 PM IST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'NewWebService'.>
    <Apr 20, 2009 1:15:40 PM IST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    java.lang.ClassNotFoundException: sqlj.runtime.ref.DefaultContext
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         Truncated. see log file for complete stacktrace
    java.lang.ClassNotFoundException: sqlj.runtime.ref.DefaultContext
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         Truncated. see log file for complete stacktrace
    >
    [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application NewWebService on DefaultServer.: sqlj.runtime.ref.DefaultContext.
    weblogic.application.WrappedDeploymentException: sqlj.runtime.ref.DefaultContext
    #### Deployment incomplete. #### Apr 20, 2009 1:15:40 PM
    oracle.jdeveloper.deploy.DeployException
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.doDeploymentAction(Jsr88RemoteDeployer.java:247)
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.deployImpl(Jsr88RemoteDeployer.java:157)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdeveloper.deploy.common.BatchDeployer.deployImpl(BatchDeployer.java:82)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:436)
         at oracle.jdeveloper.deploy.DeploymentManager.deploy(DeploymentManager.java:209)
         at oracle.jdevimpl.runner.adrs.AdrsStarter$5$1.run(AdrsStarter.java:1365)
    Caused by: oracle.jdeveloper.deploy.DeployException
         at oracle.jdevimpl.deploy.common.Jsr88DeploymentHelper.deployApplication(Jsr88DeploymentHelper.java:413)
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.doDeploymentAction(Jsr88RemoteDeployer.java:238)
         ... 11 more
    Caused by: oracle.jdeveloper.deploy.DeployException: Deployment Failed
         at oracle.jdevimpl.deploy.common.Jsr88DeploymentHelper.deployApplication(Jsr88DeploymentHelper.java:395)
         ... 12 more
    #### Cannot run application NewWebService due to error deploying to DefaultServer.
    [Application NewWebService stopped and undeployed from Server Instance DefaultServer]
    6. when i goto the consoleof weblogic server, already an instance created. But nothing displayed under WebServices.
    7. Select the instance and press 'Start'. While deploying an error came.
    java.lang.Exception: [DeploymentService:290049]Deploy failed for id '1,240,213,727,265' since no targets are reachable.
    Please help me..
    its very urgent...
    Regards,
    Resmi.

    Oh, no - another very urgent question. The world must be about to end ;)
    Resmi, Have a read of [url http://forums.oracle.com/forums/thread.jspa?threadID=883293]this - JDeveloper 11g, as of today, doesn't (at least is not supposed to) support publishing PL/SQL procedures/packages as a web service.
    John

  • How to Print the Value of a variable inside a PL/SQL package

    Hi Friends,
    Here is my Scenario
    I have a PL/SQL Package. Let us call it Baseline Package.
    This Package includes a dynamically built merge Statement.
    Execute Immediate v_merge_query.
    I have a procedure which replaces which few Keywords from the Package Text and Creates a new one depending on Inputs I provide. (This is something like a Code generator)
    Now while Creating the new package, I need to print the Value of v_merge_query.... I Need s Static Query to be Printed inside the new package and not a dynamic query.
    My Question is "Is there a way to print the value of the variable inside a different PL/SQL package?
    Thanks in Advance,
    Mohit

    Print where?
    That PL/SQL code is server-side code. It runs in an Oracle server process.
    That server process does not have a keyboard. Or a screen/monitor. Or display canvas. Or an attached printer.
    That server process is incapable of "printing" as that is not its job or responsibility and not part of its environment.
    What is can do is record data for the client to look at afterwards. This can be done using static PL/SQL session variables. Or a SQL table.
    The former is done by DBMS_OUTPUT - a very primitive interface for writing text into a static PL/SQL string array. That btw resides in expensive private process server memory. The client can query the array after a database call and render the contents.
    PS. Also keep in mind that bind variables are critical for performance and server robustness - especially when (ab)using dynamic SQL.

  • Error when publishing a PL/SQL package as a Webservice

    Hi all,
    I am using the JDeveloper (10.1.3.1.0) to publish a PL/SQL package as a Webservice, and I am having some troubles on the generation process.
    The problem that I am facing is on the generated code for the database side, where some methods have a “$GET_” at the end of its name.
    This “$GET_” is handled by the database as a special word, and the package can’t be compiled.
    If the ‘$’ character is removed from all the methods, the package can be compiled and the Webservice works fine.
    What’s wrong? Is there a bug on the generation process of the JDeveloper?
    Regards,
    Rui Torres

    OK, This is the PL/SQL package:
    Function:
    FUNCTION Obtener_paises RETURN res_webservice AS
    v_respuesta res_webservice;
    i PLS_INTEGER:=1;
    CURSOR C_paises IS
    SELECT cpais, tpais
    FROM paises
    ORDER BY tpais;
    BEGIN
    v_respuesta := res_webservice(null,null);
    v_respuesta.error := res_error(null,null,null);
    v_respuesta.error.cerror := 0;
    v_respuesta.error.cerror_ora := 0;
    v_respuesta.error.terror := null;
    v_respuesta.datos := res_datos ();
    FOR v_pais IN C_paises LOOP
    v_respuesta.datos.extend;
    v_respuesta.datos(i) := reg_datos(null,null);
    v_respuesta.datos(i).codigo := v_pais.cpais;
    v_respuesta.datos(i).descripcion := v_pais.tpais;
    i := i + 1;
    END LOOP;
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:0');
    RETURN v_respuesta;
    EXCEPTION
    WHEN OTHERS THEN
    v_respuesta.error.cerror := 1;
    v_respuesta.error.cerror_ora := SQLCODE;
    v_respuesta.error.terror := substr(SQLERRM,1,80);
    Insertar_log(NULL,SYSDATE,'C','Obtener_paises',NULL,'ERROR:1 '||substr(SQLERRM,1,120));
    RETURN v_respuesta;
    END Obtener_paises;
    TYPES USED:
    CREATE OR REPLACE
    TYPE res_webservice AS OBJECT (error res_error, datos res_datos);
    CREATE OR REPLACE
    TYPE res_error AS OBJECT (cerror NUMBER(1), cerror_ora VARCHAR2(12), terror VARCHAR2(80));
    CREATE OR REPLACE
    TYPE res_datos AS TABLE OF reg_datos;
    CREATE OR REPLACE
    TYPE reg_datos AS OBJECT(codigo VARCHAR2(12), descripcion VARCHAR2(150));
    Thanks in advanced...
    Could happen this bacause of these defined types???

  • Error while generating wrapper pl/sql with JDeveloper 10.1.3 (production)

    Hello,
    I'm generating a webservice from pl/sql package which returns a collection.
    JDeveloper generates wrapper pl/sql which gives errors when executed in the database because it consists of code like:
    PROCEDURE "NAME"$PROC_NAME_A
    The " creates database errors. When i remove these " the packages compiles.
    But when i insert the service based upon this procedure, I get an "PLS-00103: Encountered the symbol "$" when expecting something else" error.This looks like the same code is inserted again.
    Anyon an idea to get rid of these problems?
    Regards,
    Ruben Spekle

    I'm having the same problem. Did anyone ever help you, or have you resolved this yet?

Maybe you are looking for

  • Application Manager no longer works after I got a new computer.

    Application Manager no longer works after I got a new computer. I moved all of my data from one mac to the other, but the Adobe Suite no longer works. I tried to re-install it, but it says now that Application Manager is damaged, it keeps sending me

  • Can I run a Sawtooth without an internal HDD?

    Hey all, I recently started seeing my S.M.A.R.T. staus on my non-factory internal HDD as "failing" once in a while. Having some experience with this in the past, I decided to immediately dump the entirety of my 100GB WD internal ATA onto my maxtor fi

  • Can't import to Library - Error

    I get this errror message when trying to import from CD to my library: "Error occured while converting the file..The disk you are attempting to use is full." I have a brand new HP laptop with 100G free so space isn't a problem. Can someone help. Than

  • Any way to improve FR?

    After trying it for a few weeks, FR feels like the "other guys" developed it. Are there workarounds, alternatives, etc for any of the following (I've looked here and not found anything) 1. Takes several clicks on the remote to get FR started 2. You a

  • Connect with RC file authentication

    hello, Attempting to connect HSQL db by calling a config file from a java command line. However, receiving the following error message: Failed to retrieve connection info for database 'personal': Please set up authentication file 'C:\Documents and Se