Dose oracle.sql.ArrayDescriptor support the user defined type in package?

Hi folks:
I get a obstacle in calling stored procedure by using JDBC driver (ojdbc14.jar).
I have the following code:
create or replace package xxx AS
type var_table is table of varchar2(50);
procedure(parameter in var_table);
end xxx;
When I use the jdbc driver try to create a type for
oracle.sql.ArrayDescriptor arrayDes = oracle.sql.ArrayDescriptor.createDescriptor( "var_table ",connection);
The SQLException is thrown out like those:
Invalid name pattern:user_schema. var_table
So, my question is : Dose oracle.sql.ArrayDescriptor not support the user defined type in package? And I also tried to define such type by using sql "create xxxx" outside of package, then there is no SQLException.
Hopefully for your response and suggestion.Thanks...

To my knowledge, the Oracle JDBC driver does not support using the ArrayDescriptor for array data types (varray or nested table) that are defined inside of a package. The same is true for StructDescriptor as well. If you want to use array and object data types, you must define them outside of a package. Then you'll be able to use the descriptors in your JDBC programs.

Similar Messages

  • Oracle 11g AQ : problem enqueue user-defined type with varchar2 attribute

    Hello.
    I have a problem enqueuing a user-defined type to the queue on Oracle 10g.
    I'm using jdbc driver (ojdbc5.jar, version 11.1.0.6.0) as they provide oracle.jdbc.aq package.
    The type is following:
    CREATE OR REPLACE TYPE FIXED_T5 AS OBJECT
    (id integer,
    label varchar2(100),
    code integer,
    today date
    )I have created a java class for this type with jpub utility supplied with oracle 11g client package:
    jpub -user=scott/tger -url=jdbc:oracle:thin:@host:sid-sql=FIXED_T5:ru.invito.FixedType -compile=falseIt generated FixedType.java and FixedTypeRef.java files. Don't understand why i need the latter (FixedTypeRef).
    Then in test app:
    package ru.invito;
    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.util.Date;
    import java.util.Properties;
    import java.util.UUID;
    import junit.framework.TestCase;
    import oracle.jdbc.aq.AQAgent;
    import oracle.jdbc.aq.AQEnqueueOptions;
    import oracle.jdbc.aq.AQFactory;
    import oracle.jdbc.aq.AQMessage;
    import oracle.jdbc.aq.AQMessageProperties;
    import oracle.jdbc.aq.AQEnqueueOptions.DeliveryMode;
    import oracle.jdbc.aq.AQEnqueueOptions.VisibilityOption;
    import oracle.jdbc.driver.OracleConnection;
    import oracle.jdbc.driver.OracleDriver;
    import oracle.sql.Datum;
    import oracle.sql.STRUCT;
    import oracle.sql.StructDescriptor;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class AqTest extends TestCase {
         protected Log logger = LogFactory.getLog(getClass());
         public void testEnqueue() throws Exception {
              OracleDriver dr = new OracleDriver();
              Properties prop = new Properties();
              prop.setProperty("user", Config.USERNAME);
              prop.setProperty("password", Config.PASSWORD);
              OracleConnection connection = (OracleConnection) dr.connect(Config.JDBC_URL, prop);
              assertNotNull(connection);
              connection.setAutoCommit(false);
              enqueueMessage(connection, "INVITO.FIXED_T5Q", null);
              connection.commit();
         private void enqueueMessage(OracleConnection conn, String queueName, AQAgent[] recipients) throws SQLException,
                   IOException {
              logger.debug("----------- Enqueue start ------------");
              AQMessageProperties props = makeProps(queueName);
              AQMessage mesg = AQFactory.createAQMessage(props);
              String msqText = String.format("Hello, %s!", queueName);
              FixedType data = createData(36, msqText);
              Datum d = data.toDatum(conn);
              STRUCT s = (STRUCT) d;
              debugStruct("s", s);
              String toIdStr = byteBufferToHexString(s.getDescriptor().getOracleTypeADT().getTOID(), 20);
              logger.debug("s.toIdStr: " + toIdStr);
              StructDescriptor sd = StructDescriptor.createDescriptor("INVITO.FIXED_T5", conn);
              logger.debug("sd.toXMLString(): " + sd.toXMLString());
              mesg.setPayload(s);
              AQEnqueueOptions opt = makeEnqueueOptions();
              logger.debug("sending............");
              // execute the actual enqueue operation:
              conn.enqueue(queueName, opt, mesg);
              debugMessageId(mesg);
              logger.debug("----------- Enqueue done ------------");
         private void debugMessageId(AQMessage mesg) throws SQLException {
              byte[] mesgId = mesg.getMessageId();
              if (mesgId == null) {
                   throw new IllegalStateException("message id is NULL");
              String mesgIdStr = byteBufferToHexString(mesgId, 20);
              logger.debug("Message ID from enqueue call: " + mesgIdStr);
          * @return
          * @throws SQLException
         private FixedType createData(int ID, String label) throws SQLException {
              FixedType data = new FixedType();
              data._struct.setNChar(1);// initializes the flag for 'label' field
              data.setId(ID);
              data.setLabel(label);
              data.setCode(1);
              Date today = new Date();
              data.setToday(new Timestamp(today.getTime()));
              return data;
          * @param string
          * @param s
          * @throws SQLException
         private void debugStruct(String string, STRUCT s) throws SQLException {
              logger.debug(s + ".debugString(): " + s.debugString());
              logger.debug(s + "s.dump(): " + s.dump());
          * @return
          * @throws SQLException
         private AQAgent makeAgent() throws SQLException {
              AQAgent ag = AQFactory.createAQAgent();
              ag.setName("AQ_TEST");
              String agentAddress = null;
              try {
                   agentAddress = InetAddress.getLocalHost().getHostAddress();
              catch (UnknownHostException e) {
                   logger.error("cannot resolve localhost ip address. will not set it as AQ Agent address");
                   agentAddress = "NA";
              ag.setAddress(agentAddress);
              return ag;
         private AQMessageProperties makeProps(String queueName) throws SQLException {
              final String EXCEPTION_Q_TEMPLATE = "AQ$_%sT_E";
              final int DEFAULT_DELAY = 0;
              final int DEFAULT_EXPIRATION = -1;
              final int DEFAULT_PRIORITY = 0;
              AQMessageProperties propeties = AQFactory.createAQMessageProperties();
              propeties.setCorrelation(UUID.randomUUID().toString());
              propeties.setDelay(DEFAULT_DELAY);
              propeties.setExceptionQueue(String.format(EXCEPTION_Q_TEMPLATE, queueName));
              propeties.setExpiration(DEFAULT_EXPIRATION);
              propeties.setPriority(DEFAULT_PRIORITY);
              // propeties.setRecipientList(null);//should not set
              propeties.setSender(makeAgent());
              return propeties;
          * @return
          * @throws SQLException
         private AQEnqueueOptions makeEnqueueOptions() throws SQLException {
              AQEnqueueOptions opt = new AQEnqueueOptions();
              opt.setRetrieveMessageId(true);
              // these are the default settings (if none specified)
              opt.setDeliveryMode(DeliveryMode.PERSISTENT);
              opt.setTransformation(null);
              opt.setVisibility(VisibilityOption.ON_COMMIT);
              return opt;
          * Form the AQ reference
          * @param buffer
          * @param maxNbOfBytes
          * @return
         private static final String byteBufferToHexString(byte[] buffer, int maxNbOfBytes) {
              if (buffer == null)
                   return null;
              int offset = 0;
              StringBuffer sb = new StringBuffer();
              while (offset < buffer.length && offset < maxNbOfBytes) {
                   String hexrep = Integer.toHexString((int) buffer[offset] & 0xFF);
                   if (hexrep.length() == 1)
                        hexrep = "0" + hexrep;
                   sb.append(hexrep);
                   offset++;
              String ret = sb.toString();
              return ret;
    }The output is following:
    [main] 2008-07-03 19:09:49,863 DEBUG [ru.invito.AqTest] - ----------- Enqueue start ------------
    [main] 2008-07-03 19:09:50,348 DEBUG [ru.invito.AqTest] - [email protected](): name = INVITO.FIXED_T5 length = 4 attribute[0] = 36 attribute[1] = Hell
    o, INVITO.FIXED_T5Q! attribute[2] = 1 attribute[3] = 2008-07-03 19:09:49.0
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - [email protected](): name = INVITO.FIXED_T5
    length = 4
    ID = 36
    LABEL = Hello, INVITO.FIXED_T5Q!
    CODE = 1
    TODAY = 2008-07-03 19:09:49.0
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - s.toIdStr: 507ccce5b6e9f572e040007f01007203
    [main] 2008-07-03 19:09:50,363 DEBUG [ru.invito.AqTest] - sd.toXMLString(): <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <StructDescriptor sqlName="INVITO.FIXED_T5" >
      <OracleTypeADT sqlName="INVITO.FIXED_T5"  typecode="0" tds_version="1"
               is_embedded="false" is_top_level="true" is_upt="false" finalType="true" subtype="false">
        <attributes>
          <attribute name="ID"  type="INTEGER" >
            <OracleType typecode="2" />
          </attribute>
          <attribute name="LABEL"  type="VARCHAR2" >
            <OracleType typecode="12" />
          </attribute>
          <attribute name="CODE"  type="INTEGER" >
            <OracleType typecode="2" />
          </attribute>
          <attribute name="TODAY"  type="DATE" >
            <OracleType typecode="0" />
          </attribute>
        </attributes>
      </OracleTypeADT>
    </StructDescriptor>
    [main] 2008-07-03 19:09:50,379 DEBUG [ru.invito.AqTest] - sending............
    [main] 2008-07-03 19:09:50,395 DEBUG [ru.invito.AqTest] - Message ID from enqueue call: 511ff143bd4fa536e040007f01003192
    [main] 2008-07-03 19:09:50,395 DEBUG [ru.invito.AqTest] - ----------- Enqueue done ------------But when dequeueing the 'label' attribute is lost:
    DECLARE
    dequeue_options     DBMS_AQ.dequeue_options_t;
    message_properties  DBMS_AQ.message_properties_t;
    message_handle      RAW(16);
    message             fixed_t5;
    BEGIN
      dequeue_options.navigation := DBMS_AQ.FIRST_MESSAGE;
      DBMS_AQ.DEQUEUE(
         queue_name          =>     'fixed_t5q',
         dequeue_options     =>     dequeue_options,
         message_properties  =>     message_properties,
         payload             =>     message,
         msgid               =>     message_handle);
      DBMS_OUTPUT.PUT_LINE('ID   : '||message.id);
      DBMS_OUTPUT.PUT_LINE('Label: '||message.label);
      DBMS_OUTPUT.PUT_LINE('Code : '||message.code);
      DBMS_OUTPUT.PUT_LINE('Today: '||message.today);
      COMMIT;
    END;
    ID   : 36
    Label:
    Code : 1
    Today: 03.07.08
    Could anyone tell me what is wrong with the setup/code?
    Why 'label' not saved in queue, though i saw it is not empty in STRUCT?

    Thank you for the reply!
    I have enqueued:
    [main] 2008-07-04 15:30:30,639 DEBUG [ru.invito.UserDefinedTypeAqTest$1] - [email protected](): name = INVITO.FIXED_T5
    length = 4
    ID = 41
    LABEL = Hello, INVITO.FIXED_T5Q!
    CODE = 1
    TODAY = 2008-07-04 15:30:30.0and in table (select * from FIXED_T5QT) the 'label' is blank:
    Q_NAME     FIXED_T5Q
    MSGID     51310809B5EA3728E040007F01000C79
    CORRID     b8f38fd3-4fa6-4e0f-85d1-2440d02d655e
    PRIORITY     0
    STATE     0
    DELAY     
    EXPIRATION     
    TIME_MANAGER_INFO     
    LOCAL_ORDER_NO     0
    CHAIN_NO     0
    CSCN     0
    DSCN     0
    ENQ_TIME     04.07.2008 15:28:44
    ENQ_UID     INVITO
    ENQ_TID                       4012
    DEQ_TIME     
    DEQ_UID     
    DEQ_TID     
    RETRY_COUNT     0
    EXCEPTION_QSCHEMA     AQ$_INVITO
    EXCEPTION_QUEUE     FIXED_T5QT_E
    STEP_NO     0
    RECIPIENT_KEY     0
    DEQUEUE_MSGID     
    SENDER_NAME     AQ_TEST
    SENDER_ADDRESS     10.1.1.137
    SENDER_PROTOCOL     
    USER_DATA.ID     41
    USER_DATA.LABEL     
    USER_DATA.CODE     1
    USER_DATA.TODAY     04.07.2008 15:30:30I must point to a strange thing: when the FixedType instance is created (via new operator) and then the setLabel("....") called as:
    FixedType data = new FixedType();
    // hack: proper initialization for 'label' field
    data._struct.setNChar(1);
    data.setId(ID);
    data.setLabel(label);
    data.setCode(1);
    Date today = new Date();
    data.setToday(new Timestamp(today.getTime()));
    Datum d = data.toDatum(connection);
    STRUCT s = (STRUCT) d;
    logger.debug(s + ".debugString(): " + s.debugString());
    logger.debug(s + ".dump(): " + s.dump());and if i comment line (data._struct.setNChar(1);) the debug messages for created STRUCT also shows empty value for label.
    But if i explicitly call data._struct.setNChar(1) then debug contains the label i defined in call to the setLabel method.

  • In java ,how to access the  user-defined type of pl/sql?

    in my application,i using the following code to access the pl/sql type self-defined,but it throws run-time exception,how can i resolve it?String sqlStr="{call BossStat.dunStat(?,?,?,?,?,?)}";
    OracleCallableStatement ocstmt=(OracleCallableStatement)conn.prepareCall(sqlStr);
    int paramIndexInt=1;
    ocstmt.setInt(paramIndexInt++,100);
    ocstmt.setInt(paramIndexInt++,1);
    ocstmt.setInt(paramIndexInt++,1);
    ocstmt.setTimestamp(paramIndexInt++,new java.sql.Timestamp(System.currentTimeMillis()));
    ocstmt.setTimestamp(paramIndexInt++,new java.sql.Timestamp(System.currentTimeMillis()));
    ocstmt.registerOutParameter(paramIndexInt++,OracleTypes.ARRAY,"BossStat.TP_STATLABELVAR");
    ocstmt.execute();

    You can have a look at this how to document
    http://otn.oracle.com/sample_code/tech/java/codesnippet/jdbc/objects/ObjectTypes.html
    You can apply similar concept if you want to use stored procedure.
    If you still get problems, post the type that you have created and the error you are getting.
    Chandar

  • Deploying c# procedure with user-defined type

    Hi
    I've written a c# procedure which makes use of some Oracle user-defined types (c# classes generated using the wizard).
    I will be calling the procedure from an Oracle package and one of the out parameters needs to be one of my user defined Oracle objects (basically a record object). My problem is when I come to deploy the package, it tells me "... does not contain any .NET stored procedures that can be deployed to Oracle"
    If I change the user defined type (out param) to something like an Int32 or string, it works fine. AFAIK the latest version of ODT/ODAC supports user defined types. For Info I've 11g Client , .Net v4 & VS2010
    quick example of procedure entry point.
    works:
    public static void GetOrderCost(int OrderNr, out Int32 orderCost )
    Not work:
    public static void GetOrderCost(int OrderNr, out ORDER_RECORD orderCost ) - Note: ORDER_RECORD is the class created using the class generation wizard.
    I've spent 2 days now trying to get this to work, perhaps its not possible or perhaps my setup is not quite right but any help gratefully received.
    Ian

    think I have found some small print which scuppers my plan. Good if some one could confirm and nicer if someone could suggest a workaround (without resorting to writing the UDT to a Oracle table)
    Oracle User-Defined Type (UDT) Support
    UDTs are not supported within a context connection but they are supported with a client connection. UDTs are not supported as parameters to .NET stored procedures.
    Source:
    http://docs.oracle.com/cd/E14435_01/win.111/e10927/extenRest.htm#CJAHJBJI
    So you can use UDT's within the body of the procedure (and can read them off the DB) but as yet its not possible to use them as parameters.

  • Web Logic Optimize the User-defined typed values

    I'm using Together Soft 6.0.1 and Web Logic 7.0 as apps. server. I'm writing
    the web service using the user defined type as input parameter and return status.
    I'm experience the following probem
    1. On the web service, the return status is an array user-defined data type.
    Some of the data has the same values.
    2. When I looked at the SOAP/XML message as the returned status, the fields/tags
    that have the same data got mapped to a href=#ID_x and on the bottom of the SOAP/XML
    message the ID_x is mapped to the correct data value.
    3. However, when the SOAP/XML message is mapped to the client's object, the data
    did not get mapped correctly to the object's attribute. The attributes, that
    got mapped to href=#ID_x, are set to empty value.
    I wrote the serialize/deserialize code for the User-Defined type, and that works
    ok. However, when I return an array of User-Defined type, and only have the serialize/deserialize
    code for the User-Defined type but no code for the array, it throws an exception
    (Array out of bound).
    It looks like Weblogic creates a reference table appended to the message with
    duplicate values indexed. Is it some kind of performance option you can turn
    off?
    Or is there some interface to retrieve the references?
    Or is there a work around or a fix to this problem?
    Or do I have to write the serialize/deserialize codes for the user-defined type
    and array of user-defined type?
    Thanks for your help,
    Michelle

    Scott,
    Thanks for your response.
    So you're saying the href "optimization" is a feature of soap encoding. Is it
    the Web Logic implementation of soap encoding optimize the values?
    If we write xxxCodec.java for the array of user-defined type, will it work?
    If it does, could you send me sample code? The example in the document is for
    a single class. The array seems to be more complicated.
    Thanks for your help,
    Michelle
    [email protected] (Scott Ziegler) wrote:
    I would suggest using a document-literal style webservice. The
    literal part avoids soap encoding which is responsible for the href
    "optimization".
    --Scott
    In article <[email protected]>,
    Michelle Hoang <[email protected]> wrote:
    I'm using Together Soft 6.0.1 and Web Logic 7.0 as apps. server.
    I'm writing the web service using the user defined type as input
    parameter and return status. I'm experience the following probem
    1. On the web service, the return status is an array user-defined
    data type. Some of the data has the same values.
    2. When I looked at the SOAP/XML message as the returned status, the
    fields/tags that have the same data got mapped to a href=#ID_x and on
    the bottom of the SOAP/XML message the ID_x is mapped to the correct
    data value.
    3. However, when the SOAP/XML message is mapped to the client's
    object, the data did not get mapped correctly to the object's
    attribute. The attributes, that got mapped to href=#ID_x, are set to
    empty value.
    I wrote the serialize/deserialize code for the User-Defined type, and
    that works ok. However, when I return an array of User-Defined type,
    and only have the serialize/deserialize code for the User-Defined
    type but no code for the array, it throws an exception (Array out of
    bound).
    It looks like Weblogic creates a reference table appended to the
    message with duplicate values indexed. Is it some kind of
    performance option you can turn off? Or is there some interface to
    retrieve the references? Or is there a work around or a fix to this
    problem? Or do I have to write the serialize/deserialize codes for
    the user-defined type and array of user-defined type?
    Thanks for your help,
    Michelle

  • View Object with User Defined Type input

    I am trying to use a View Object with a query that requires a user defined object as an input parameter.
    I have the query working with a PreparedStatement, but would like to use a View Object.
    When I use the PreparedStatement, I prepare the user defined type data like this:
    // get the data into an object array
    Object[] wSRecObjArr = wSRec.getObjectArray();
    // set up rec descriptor
    StructDescriptor WSRecDescriptor = StructDescriptor.createDescriptor("WS_REC",conn);
    // populate the record struct
    STRUCT wSRecStruct = new STRUCT(WSRecDescriptor,conn,wSRecObjArr);
    Then I can use this in the PreparedStatement like this:
    OraclePreparedStatement stat = null;
    ResultSet rs = null;
    stat = (OraclePreparedStatement)conn.prepareStatement("Select test_pkg.test_function(?) FROM DUAL");
    stat.setSTRUCT(1, wSRecStruct);
    rs = stat.executeQuery();
    I would like to do the same process with a View Object instead of the PreparedStatement.
    My question is "How do I create the input objects"?
    I obtain the View Object from the Application Module using findViewObject(). I don't actually have a connection object to pass into the StructDescriptor.createDescriptor method.
    I have tried just using Java Object Arrays (Object[]) to pass the data, but that gave an error:
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation.
    Any help or pointers are greatly appreciated.
    Thank you.
    Edited by: 942120 on May 1, 2013 8:45 AM
    Edited by: 942120 on May 1, 2013 8:46 AM
    Edited by: 942120 on May 1, 2013 9:05 AM
    Edited by: 942120 on May 1, 2013 9:06 AM

    Custom domains are the way to go.
    When I try to pass custom domains that represent my user defined types - it works.
    However, one of the functions requires a table of a user defined type be passed in.
    I tried creating a domain of the table type. It forces me to add a field during creation (in JDEV), so I tried adding a field of type Array of Element of the domain representing the user defined type.
    I populate the table by setting the field I created, but the table is empty in PL/SQL (TEST_TAB.COUNT = 0).
    I also tried passing the oracle.jbo.domain.Array object, but that produced an error:
    java.sql.SQLException: ORA-06553: PLS-306: wrong number or types of arguments in call
    I also tried passing Object[], but that produced an error:
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation.
    How do I properly create, and pass an domain that represents a table of a user defined type?
    When I use a OraclePreparedStatement, I can pass a oracle.sql.ARRAY using stat.setARRAY.
    Thank you for the help you have provided, and any future advice.
    JDEV 10.1.2.3
    JDBC 10.2.0.5
    Edited by: 942120 on May 13, 2013 7:13 AM
    Edited by: 942120 on May 13, 2013 7:16 AM

  • Issue in passing Oracle User Defined Types to PL SQL from Websphere Applica

    HI,
    I am facing an issue when trying to pass Oracle collection object(User Defined Types) from Java to PL SQL. The issue happens inside J2EE application which is running inside Websphere Application Server 6.x. My database is Oracle 10g and i am using ojdbc1.4.jar as thin driver.
    The issue is that when i pass the Oracle Object from java side, the attribute values of the collection objects at the Oracle PL SQL side is coming as empty. I have tried the same java code in a standalone application and it works fine. The issue happens only when the application is running inside WAS.
    Anybody has any idea how to pass Oracle User Defined Types from WAS 6.x server to Oracle PL SQL?

    Andy Bowes wrote:
    Hi
    I am using WebLogic 8.14 & Oracle 9i with thin JDBC driver.
    Our application needs to perform the same DB operation for every item in a Java Collection. I cannot acheive the required performance using the standard Prepare & Execute loop and so I am looking to push the whole collection to Oracle in a single invocation of a Stored Procedure and then loop on the database.
    Summary of Approach:
    In the Oracle database, we have defined a Object Type :
    CREATE OR REPLACE
    TYPE MYTYPE AS OBJECT
    TxnId VARCHAR2(40),
    Target VARCHAR2(20),
    Source VARCHAR2(20),
    Param1 VARCHAR2(2048),
    Param2 VARCHAR2(2048),
    Param3 VARCHAR2(2048),
    Param4 VARCHAR2(2048),
    Param5 VARCHAR2(2048),
    and we have defined a collection of these as:
    CREATE OR REPLACE
    TYPE MYTYPE_COLLECTION AS VARRAY (100) OF MYTYPE
    There is a stored procedure which takes one of these collections as an input parameter and I need to invoke these from within my code.
    I am having major problems when I attempt to get the ArrayDescriptor etc to allow me to create an Array to pass to the stored procedure. I think this is because the underlying Oracle connection is wrapped by WebLogic.
    Has anyone managed to pass an array to an Oracle Stored procedure on a pooled DB connection?
    Thanks
    AndyHi. Here's what I suggest: First please get the JDBC you want to work in a
    small standalone program that uses the Oracle thin driver directly. Once
    that works, show me the JDBC code, and I will see what translation if
    any is needed to make it work with WLS. Will your code be running in
    WebLogic, or in an external client talking to WebLogic?
    Also, have you tried the executeBatch() methods to see if you can
    get the performance you want via batches?
    Joe

  • In which of the following sections of a PL/SQL block is a user-defined exception raised?

    Hi,
    A (somewhat elementary) question:
    In which of the following sections of a PL/SQL block is a user-defined exception raised?
    a) Exception section
    b) Declarative section
    c) Error handling section
    d) Executable section
    I'd be interested to hear people's answers.
    Thanks.

    As Etbin already noted, there are only 3 sections and user-defined exception can be raised in any of them. User-defined exception raised in declarative section example:
    declare
        year_zero exception;
        pragma exception_init(year_zero,-01841);
    begin
        declare
            v_dt date := to_date(1721420,'j');
        begin
            null;
        end;
      exception
        when year_zero
          then
            dbms_output.put_line('Year 0!');
    end;
    Year 0!
    PL/SQL procedure successfully completed.
    SQL>
    User-defined exception raised in executable section example:
    declare
        year_zero exception;
        pragma exception_init(year_zero,-01841);
        v_dt date;
    begin
        v_dt := to_date(1721420,'j');
      exception
        when year_zero
          then
            dbms_output.put_line('Year 0!');
    end;
    Year 0!
    PL/SQL procedure successfully completed.
    SQL>
    User-defined exception raised in exception handling section example:
    declare
        year_zero exception;
        pragma exception_init(year_zero,-01841);
        v_dt date;
    begin
        declare
            v_num number;
        begin
            v_num := 1 / 0;
          exception
            when others
              then
                v_dt := to_date(1721420,'j');
        end;
      exception
        when year_zero
          then
            dbms_output.put_line('Year 0!');
    end;
    Year 0!
    PL/SQL procedure successfully completed.
    SQL>
    SY.

  • APP-ALR-04106: Please correct the user-defined SQL statement for this alert

    Hi All,
    I have created an alert for engineering module in R12. It got tested and was working fine. when the user testing it, while trigger the alert getting the error, "APP-ALR-04106: Please correct the user-defined SQL statement for this alert".
    when verified the alert, it got verified and ran also. It parsed the query successfully and when run it fetched few records.
    Need help in resolving the issue.
    Thanks in advance.
    Regards,
    sri
    Edited by: user10939296 on Jan 18, 2010 1:16 AM

    Hi Sri;
    I have already gone through the Note: 948037.1. But this note is related to 11i. The solution provided in the Note is for 11i.
    I am facing this issue in R12. Is this patch applicable to R12?I belive its not. But u can check Solution part 4 for your instance, at least it can give you idea. The other note in metalink related bug and all for R11 too.
    I belive its better way to rise Sr while waiting other forum user response to that thread
    Regard
    Helios

  • Calling Oracle stored procedure with out param of user define type from Entity Framework 5 with code first

    Guys i am using Entity Framework 5 code first (I am not using edmx) with Oracle and all works good, Now i am trying to get data from stored procedure which is under package but stored procedure have out param which is user define type, Now my question is
    how i will call stored procedure from entity framework
    Thanks in advance.

    I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
    If you think you are going to get existing MS Stored Procedures  or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
    coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
    You could use the EF backdoor, call Oracle Command object and use the Packages,  if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
    That's about your best shot.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx

  • Using stored procedure with Oracle user-defined types in database control

    Hi,
    I have a requirement where I need to call an Oracle Stored Proc which has IN and OUT parameters. OUT parameters are of user-defined types in Oracle packages.
    I am getting error while calling the Stored proc like below:
    Procedure:
    ==========
    create or replace
    PROCEDURE AA_SAM_TEST (
    col1 out types_aa.aa_tex_type ,
    col2 out types_aa.aa_tex_type ,
    col2 out types_aa.aa_num_type ) As
    Types:
    ======
    create or replace
    package types_aa as
    type aa_tex_type is table of varchar2(255) index by binary_integer;
    type aa_num_type is table of char index by binary_integer;
    end
    Wli Code:
    =========
    DB Control:
    ===========
    * @jc:sql statement="call AA_SAM_TEST(?,?,?)"
    void Call_AA_SAM_TEST(SQLParameter[] param) throws SQLException;
    JPD Code:
    =========
    param = new SQLParameter[3];
    Object param1 = new String();
    Object param2 = new String();
    Object param3 = new String();
    this.param[0] = new SQLParameter(param1 , Types.STRUCT, SQLParameter.OUT);
    this.param[1] = new SQLParameter(param2, Types.STRUCT, SQLParameter.OUT);
    this.param[2] = new SQLParameter(param3, Types.STRUCT, SQLParameter.OUT);
    database_Update.Call_AA_SAM_TEST(this.param);
    I am getting the following error...
    <Jul 24, 2007 6:47:42 PM IST> <Warning> <WLW> <000000> <Id=database_Update; Method=Ctrl_files.Database_Update.Call_AA_SAM_TEST(); Failure=java.sql.SQLException: ORA-06553: PLS-:
    ORA-06553: PLS-:
    ORA-06553: PLS-:
    ORA-06553: PLS-:
    ORA-06553: PLS-:
    ORA-06553: PLS-306: wrong number or typ
    ORA-06553: PLS-306: wrong number or types of arguments in call to 'AA_SAM_TEST'
    ORA-06553: PLS-306: wrong number or types of arguments in call to 'AA_SAM_TEST'
    Can anyone know how to specify OUT parameter of USer-Defined types while using a DB control to access a Stored Proc in Oracle.
    Any help is highly appreciated.
    Thanks

    Hi,
    I have similar problem. Have you already solved the issue?
    Thanks

  • Object Diagrams that support user define type (create type....and subtypes

    Hello it would be very nice to be able to use user define types in a diagram, at this time oracle, ibm db2 9 and sql server 2005 suport sql ansi 2003 and to use all this potential we have to take tecnology foward. My sugestion is create object diagram that can help design all this funtionability, rational rose has the oracle8 addin this will give you an exact idea of what i am asking.
    Thanks for your atention and let me know if you are planing to do this.
    Perhaps this is not the right forum please tell me where I can send this as a future requests

    JDeveloper has a UML class diagram with transformation into a Java class diagram - are you looking for anything beyond that?

  • Will any change in tempdb database affect the user defined tables?

    Will any change in tempdb database affect the user defined tables?
    Suppose I have deleted a table from system database tempdb, will it effect the user defined tables?
    Anujit Karmakar Sr. Software Engineer

    The short answer is no; deleting a table from tempdb will not affect user databases.
    Of course I could make up some connection between the two that you haven't described. For example, if a stored procedure created a temporary table, and was busy using it when you deleted it, the deletion could cause unexpected behavior in the user database,
    which could affect some table data.
    Also, some system actions in user databases can store data in tempdb temporarily. But you aren't likely to be talking about system usages of tempdb.
    So, unless you describe some connection, the tables in tempdb are independent from the user database tables.
    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty

  • PL/SQL and User Defined Types.....

    Hi All,
    I defined TEST_1 User Defined Type where VALUE_PART field is a VARCHAR2 type.
    TEST_1 is placed under sys so that everyone can use this type in Oracle 9i.
    CREATE TYPE TEST_1 AS OBJECT (
    VALUE_PART VARCHAR2(50),
    x NUMBER,
    y NUMBER
    This TEST_1 object type will be used as nested tables in the EMPLOYEE table where each attribute might require different bytes of VARCHAR2’s in the VALUE_PART field.
    CREATE TYPE NAME AS TABLE OF TEST_1;
    CREATE TYPE ADDRESS AS TABLE OF TEST_1;
    CREATE TYPE DEPARTMENT AS TABLE OF TEST_1;
    CREATE TABLE EMPLOYEE (
    SSN NUMBER,
    NAME TEST_1,
    ADDRESS TEST_1,
    DEPARTMENT TEST_1,
    SALARY NUMBER
    NESTED TABLE NAME STORE AS NAME_TABLE;
    NESTED TABLE ADDRESS STORE AS ADDRESS_TABLE;
    NESTED TABLE DEPARTMENT STORE AS DEPARTMENT_TABLE;
    Is it possible to specify VALUE_PART in the TABLE OF statement with different number of bytes?
    Is there any way to do that through methods or some other ways that I may not be aware of?
    For Example:
    /*This should allocate 10 bytes of VARCHAR2. */
    CREATE TYPE NAME AS TABLE OF TEST_1(10);
    /* and 30 bytes of VARCHAR2. */
    CREATE TYPE ADDRESS AS TABLE OF TEST_1(30);
    /*and 10 bytes of VARCHAR2. */
    CREATE TYPE DEPARTMENT AS TABLE OF TEST_1(10);
    Any help is appreciated.
    Thanks a lot.

    TEST_1 is placed under sys so that everyone can use
    this type in Oracle 9i.that's just wrong on sooo many levels. don't EVER put anything in sys.
    put it under an appropriate user, grant it, even create a synonym for it.
    and how would putting it under sys make it "so that everyone can use" it? unless you put everything else under sys as well.

  • How to let the user define the colors for each plots in the graph (I use LabVIEW 7)?

    How to let the user define the colors for each plots in the graph (I
    use LabVIEW 7)?

    Hi,
    Take a look at this example, it uses property nodes to select tha
    active plot and then changes the color of that plot.
    If you want to make the number of plots dynamic you could use a for
    loop and an array of color boxes.
    I hope this helps.
    Regards,
    Juan Carlos
    N.I.
    Attachments:
    Changing_plot_color.vi ‏38 KB

Maybe you are looking for

  • No video on our end

    Just tried skype on xbox one. We could see them but they could not see us. The lower right hand mini screen is completely green. When I go into kinect settings, it works in there. Thoughts?

  • Iphoto upgrade it says your photos will not be readable following update. Will my photos be lost?

    Your photo library will not be readable by previous versions of iphoto after the upgrade. Some may be on the cloud but how can I save them? I haven't backed anything up and can't open iphoto to try. I/ve copied it onto my desktop but can't open that

  • Image not being deisplayed

    when the application is deployed to the remote server. The only browser that will display the image correctly is IE9. Re: images do not show when deployed on remote server Any ideas?

  • MS CRM 2011 with UCCX 10

    Hello, It's my first time to do integration with CRM. I have some questions regarding this integratio : 1. How can I do this integration ? Is the JDBC Driver is enough or do I need some connector (eg. B+S Connector) ? 2. Add Callback Button allowing

  • Adobe PDF Printer - Adobe Recommended?

    I have a vague memory of reading on these forums that Adobe recommends using the Adobe PDF virtual print driver when generating PDFs from FrameMaker. If I remember correctly, using a physical print driver was not recommended. I've tried searching the