Arbitrary object types in PL/SQL call with OCI for Oracle 9.2

Hi,
i'm trying to develop a generic library that is able to execute a call to a pl/sql with a generic list of types.
If the objects are native (i.e. number, varchar2...) works fine, but i cannot understand how to do the same with a generic user defined object.
For example:
CREATE OR REPLACE TYPE A AS object (
     B     VARCHAR2(40),
     C          CLOB
CREATE OR REPLACE TYPE D AS object (
     E     A
And the pl/sql:
CREATE OR REPLACE PACKAGE PLSQL_EX IS
     PROCEDURE exempl (inInfo IN OUT D);                                   
END PLSQL_EX ;
Do you have an example of how to do this ??, obviously i dont whant to use the OTT, because i want the maximum level of flexibility. I think i have to use the OCIObjectNew functions and the related ones, but i don't know how.
thanks.
Best regards,
Stefano.

Hi,
i'trying to solve the problem with this code (just use of set Object attribute and get object Attribute) , but it doesn't work:
#define SQLCA_NONE
#define ORACA_NONE
EXEC SQL BEGIN DECLARE SECTION;
     sql_context sqlCtx;
     char* dbName = "dbName";
     char* oraPwd;
     char* oraConnection;
     char* oraUsr;
EXEC SQL END DECLARE SECTION;
#include <iostream.h>
#include <stdlib.h>
#include <string>
#include <sql2oci.h>
extern "C" {
     #include <orid.h>
sword checkErr(sword status, OCIError * error)
     text errbuf[512];
     sb4 errcode = 0;
     int     errorCode = 0;
     string     errorDesc;
     switch (status) {
          case OCI_SUCCESS:
               break;
          case OCI_SUCCESS_WITH_INFO:
               OCIErrorGet((dvoid *)error, (ub4) 1, (text *) 0, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
               errorDesc = (char *)errbuf;                    
               cout << "error: " << errorDesc << endl;
               break;
          case OCI_NEED_DATA:
               cout << "warning: NEED DATA"<< endl;
               break;
          case OCI_NO_DATA:
               cout << "warning: NO DATA" << endl;
               break;
          case OCI_ERROR:
               OCIErrorGet((dvoid *)error, (ub4) 1, (text *) 0, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
               errorDesc = (char *)errbuf;
               cout << "error: " << errorDesc << endl;
               break;
          case OCI_INVALID_HANDLE:
               cout << "error: INVALID HANDLE" << endl;
               break;
          case OCI_STILL_EXECUTING:
               cout << "error: STILL EXECUTING" << endl;
               break;
          case OCI_CONTINUE:
               cout << "error: CONTINUE" << endl;
               break;
          default:
               cout << "error: ???" << endl;
               break;
     return status;
int main ()
     OCIType *           tdo;
     dvoid *           objectPointer;
     dvoid *          null_struct =(dvoid*) 0;
     OCIString *          message4AB= (OCIString *)0;
     OCIInd                ind4AB = OCI_IND_NOTNULL;
     ub4 len[] = {1};
     const char *attrName[] = {"B"};
     dvoid *               attr_null_struct =(dvoid* ) 0;
     OCIString*           newString = (OCIString*) 0;
     OCIType *          attr_tdo;
     OCIInd                newIndMessage = OCI_IND_NULL;
     OCITypeCode           typecode ;     
     OCIEnv *     mEnvHandler;
     OCISvcCtx *      mSvcEnv;
     OCIError *     mErrorHandler;
     oraUsr = (char*) "gpridb";
     oraPwd = (char*) "gpridb";
     oraConnection = "ic9su002";
     sqlca sqlca;
     EXEC SQL CONTEXT ALLOCATE :sqlCtx;
     EXEC SQL CONTEXT USE :sqlCtx;
     EXEC SQL CONNECT :oraUsr IDENTIFIED BY :oraPwd AT :dbName USING :oraConnection;
     if (SQL_ERROR == SQLEnvGet(sqlCtx, &mEnvHandler) ) {
          cout << "Error during creation of environment Handler"<< endl;
          exit (1);     
     if (SQL_ERROR == SQLSvcCtxGet(sqlCtx, (text *)dbName, (ub4) strlen(dbName), &mSvcEnv )) {
          cout << "Error during creation of svc Environment"<< endl;
          exit (1);     
     if (SQL_ERROR == OCIHandleAlloc( mEnvHandler, (dvoid **) &mErrorHandler, (ub4) OCI_HTYPE_ERROR, 0, (dvoid **) 0)){
          cout << "cannot initialize error handler" << endl;
          exit (1);
checkErr (OCITypeByName ( mEnvHandler,mErrorHandler,mSvcEnv,(text *) 0,(ub4) 0,
               (const text *) "A", (ub4) strlen ("A"),
               (const text *)0, (ub4) 0,OCI_DURATION_SESSION,OCI_TYPEGET_ALL, &tdo),mErrorHandler);
checkErr( OCIObjectNew ( mEnvHandler, mErrorHandler, mSvcEnv,OCI_TYPECODE_OBJECT,tdo, (dvoid*)0,
               OCI_DURATION_SESSION,true ,&objectPointer),mErrorHandler);
checkErr(OCIObjectGetInd (mEnvHandler, mErrorHandler,
objectPointer, &null_struct ),mErrorHandler);
checkErr(OCIStringAssignText (mEnvHandler,mErrorHandler, (text *) "INVIO",
strlen ("INVIO") ,&message4AB),mErrorHandler);
cout << "Value in string: " << (char *) OCIStringPtr(mEnvHandler, message4AB) << endl;
checkErr(OCIObjectSetAttr (mEnvHandler, mErrorHandler, objectPointer, null_struct,
tdo, (const text **) attrName , len, (ub4) 1,(ub4 *) 0,
(ub4)0, ind4AB, &attr_null_struct,
(dvoid *) message4AB),mErrorHandler);
checkErr (OCIObjectGetAttr(mEnvHandler, mErrorHandler, objectPointer, null_struct, tdo,
               (const text **) attrName, len, 1, (ub4 *)0, (ub4)0, &newIndMessage,&attr_null_struct,
               (void **) &newString, &attr_tdo),mErrorHandler);
typecode = OCITypeTypeCode(mEnvHandler, mErrorHandler, attr_tdo);
if (newIndMessage == OCI_IND_NULL) {
          cout << "null"<< endl;
} else {
     cout << "indicator: " << newIndMessage << endl;
     switch (typecode)
     case OCI_TYPECODE_DATE : /* fixed length string */
          cout << "date" << endl;
          break;
     case OCI_TYPECODE_RAW : /* RAW */
          cout << "raw" << endl;
          break;
     case OCI_TYPECODE_CHAR : /* fixed length string */
     case OCI_TYPECODE_VARCHAR : /* varchar */
     case OCI_TYPECODE_VARCHAR2 : /* varchar2 */
          cout << "vc" << endl;
          break;
     case OCI_TYPECODE_SIGNED8:
          cout << "sign" << endl;
          break;
     case OCI_TYPECODE_UNSIGNED8:
          cout << "uns" << endl;
          break;
     case OCI_TYPECODE_OCTET:
          cout << "octet" << endl;
          break;
     case OCI_TYPECODE_UNSIGNED16: /* UNSIGNED SHORT */
     case OCI_TYPECODE_UNSIGNED32: /* UNSIGNED LONG */
     case OCI_TYPECODE_REAL: /* REAL */
     case OCI_TYPECODE_DOUBLE: /* DOUBLE */
     case OCI_TYPECODE_INTEGER: /* INT */
     case OCI_TYPECODE_SIGNED16: /* SHORT */
     case OCI_TYPECODE_SIGNED32: /* LONG */
     case OCI_TYPECODE_DECIMAL: /* DECIMAL */
     case OCI_TYPECODE_FLOAT: /* FLOAT */
     case OCI_TYPECODE_NUMBER: /* NUMBER */
          cout << "num" << endl;
          break;
     default:
          cout << "defaut" << endl;
          break;
     char p = (char ) OCIStringPtr(mEnvHandler, newString);
     cout << " read from object (" << typecode << "): " << (char *) OCIStringPtr(mEnvHandler, newString) << endl;
the output is:
Value in string: INVIO
indicator: 0
vc
read from object (9): @|

Similar Messages

  • Persisting Instance Variables in Object Types across PL/SQL Calls

    How can I persist instance variables in my java class/object across PL/SQL calls via a PL/SQL object type.
    What I am finding is that if I do not have an attribute defined in my PL/SQL datatype that the value is not persisted between calls on the object in the PL/SQL environment. I am using the SQLData interface.
    Should I create a static variable that uses the singleton pattern?
    Any insights appreciated.

    How can I persist instance variables in my java class/object across PL/SQL calls via a PL/SQL object type.
    What I am finding is that if I do not have an attribute defined in my PL/SQL datatype that the value is not persisted between calls on the object in the PL/SQL environment. I am using the SQLData interface.
    Should I create a static variable that uses the singleton pattern?
    Any insights appreciated.

  • How to initialize the object type in pl/sql

    Hi,
    I am looking for an easy way to initialize the object type in pl/sql.
    I have created a object type with around 2 attributes.
    when ever i need to initialize the object ..need to pass:
    declare
    v_obj emp_obj;
    begin
    v_obj := emp_obj(null,null);
    then i can assign the values to object.
    Since I am having more than 50 attributes.. need to pass null to all the object attributes.
    is there any other way to initialize the object.
    thanking you in advance!!!

    RTFM [url http://oraclesvca2.oracle.com/docs/cd/B10501_01/appdev.920/a96594/adobjadv.htm#1008810]Advantages of User-Defined Constructors

  • ORA-39083: Object type TRIGGER failed to create with error:

    i m getting these two error when i import data using impdp.
    ORA-39083: Object type TRIGGER failed to create with error:
    ORA-00942: table or view does not exist
    i have exported (expdp) data from production db, when i importing (impdp) the dump file to the test db i m geting the above two errors.
    example:
    ORA-39083: Object type TRIGGER failed to create with error:
    ORA-00942: table or view does not exist
    Failing sql is:
    CREATE TRIGGER "NEEDLE"."CC_BCK_TRG" BEFORE INSERT OR UPDATE
    ON NIIL.cc_bck_mgmt REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW
    DECLARE
    w_date DATE;
    w_user VARCHAR2(10);
    BEGIN
    SELECT USER,SYSDATE INTO w_user,w_date FROM DUAL;
    IF INSERTING THEN
    :NEW.cretuser :=w_user;
    :NEW.cretdate :=w_date;
    END IF;
    IF UPDATING THEN
    :NEW.modiuser :=w_user;
    :NEW.modidate :=w_date;
    END IF;
    END;
    status of the above trigger in pro db is valid. and source table also exist even though i m getting error when i import
    please suggest me...

    perhaps you don't have table... (impdp created trigger before create table)
    check about "NIIL.cc_bck_mgmt" table.
    and then create it (trigger) manual ;)
    Good Luck.

  • Need to call SET ROLE for Oracle before running report

    Hi all,
    does anyone know how I can call SET ROLE for Oracle with Crystal Reports, before running report? I'm using Crystal Reports 2008 to design report (with Server Oracle connection) and Java Reporting Component to run report within a J2EE apllication. If anyone has any idea, I'd greatly appreciate as I'm in trouble.
    Thanks a lot.

    Just a thought...
    If your report's datasource was an Oracle stored procedure, you could call a function to set the role from that SP
    You would be in the same Oracle session from  Report --> SP --> Function, so the role would be retained

  • Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc

    Hi,
    Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc.
    Reason: We have a job that creates leads, tasks in 11i, but r12 is not working as expected, an SR is open with Oracle for a long time and no solution so far. I am thinking of using SQL*loader to populate the data, but these are html pages. Will SQL* Loader work?
    12.1.4 / 11g db
    Appreciate your inputs.
    Thanks,
    K

    Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc. It should work.
    Reason: We have a job that creates leads, tasks in 11i, but r12 is not working as expected, What is the issue you have with R12?
    an SR is open with Oracle for a long time and no solution so far. I am thinking of using SQL*loader to populate the data, but these are html pages. Will SQL* Loader work?What was Oracle feedback? Did they say it is certified and can be used?
    Thanks,
    Hussein

  • PLS-00306: wrong number or types of arguments in call in a for loop

    Dear all
    I recently put up another post about the same error message but as the message now relates to another part of my programme and, in my mind at least, a different conceptual idea, I thought I should start a new top. If that is not right thing to have done then please let me know. I am working in 10.2.
    I am trying to pass through multiple variables. When I run the code at the end of this question I get an error message:
    PLS-00306: wrong number or types of arguments in call to 'CUR_MAP_LIST'This relates to the line:
    FOR var_map_list IN cur_map_list (par_map_list (n))I think the reason the error message comes up is because par_map_list is a associate array / PL/SQL table and cur_map_list is based on %rowtype. Although I could be wrong. However I am not sure what I should be doing so that I don't get such an error message.
    I was reading through page 623 on Web Development 9i (by Brown; pub. McGrew-Hill) and pages 357-358 of Oracle Web Application Programming for PL/SQL Developers (by Boardman, Caffrey, Morse, Rosenzweig; pub. Prentice Hall), in order to try and write my code. As well as Oracle's Application Developer’s Guide - Fundamentals (Release 2), page 11-6. In particular the Web Development book uses the following:
    create or replace procedure query_department
    (in_dept_no owa_util.ident_arr)
    is
    cursor dept_cursor (nbt_dept_no emp.deptno%TYPE) is
    select empno, ename, mgr, sal, comm
    from scott.emp
    where deptno = nbt_dept_no;
    begin
      for x in 1 .. in_dept_no.count loop
        for dept_rec in dept_cursor(in_dept_no (x)) loop
        end loop;
      end loop;
    end;In that example the cursor selects empno, ename, mgr, sal and comm from emp. So if it is doing that the cursor must be of a VARCHAR2 and NUMBER data type. What I don't understand is the for dept_rec in part. For a start I am not sure where dept_rec comes from? If it is a NUMBER data type, how can the in_dept_no, which is a owa_util.ident_arr associate array / PL/SQL data type work with it. Unfortunately because the example is incomplete and doesn't include procedures relating to the in variables, I am unable to run it and try and learn from what it is doing, so that I can try and relate the concept to my own work.
    My programme is as follows. There may be other errors in the code not relating to this error. If so I hope to find these and resolve them once I understand what I should be doing here:
    --Global variables--
    gvar_mapviewer_host VARCHAR2(56) := 'http://tiger.iso.port.ac.uk:7785/mapviewer/omserver';
    gvar_proc_host VARCHAR2(56) := 'http://tiger.iso.port.ac.uk:7785/www/geg50160';
    gvar_xml_request VARCHAR2(100) :='?xml_request=<?xml version="1.0" standalone="yes"?>';
    --Main calling programming--
    PROCEDURE MAPS AS
    empty owa_util.ident_arr;
    var_xml_theme VARCHAR2(32767);
    BEGIN
    PROCMAPLIST (empty, var_xml_theme);
    END maps;
    --create checkboxes--
    PROCEDURE PROCCHECKLIST
    (par_check_list IN OUT owa_util.ident_arr,
      par_xml_theme OUT VARCHAR2
      AS
       CURSOR cur_map_list IS
        SELECT MT.map_title
               MI.map_id
               OMSN.map_sheet_number_id
               WRMF.web_raster_map_id
         FROM MAP_TITLE MT
              MAP_INFO MI
              MAP_SHEET_NUMBER OMSN,
              WEB_RASTER_MAP_FILE WRMF,
          WHERE MI.map_title_id = MT.map_title_id
          AND   MI.map_id = OMSN.map_id
          AND   WRMF.map_id = MI.map_id
          AND   WRMF.map_sheet_number_id = OMSN.map_sheet_number_id;
        var_map_list cur_map_list%ROWTYPE;
        var_xml_theme VARCHAR2(32767);
    BEGIN
    htp.htmlOpen;
    htp.headOpen;
    htp.headClose;
    htp.bodyOpen;
    htp.print('<FORM METHOD = "post"
                     ACTION = "'||gvar_proc_host||'.mappackage.procdisplay">');
        htp.print('<FIELDSET>
                     <LEGEND> Select the maps you wish to display </LEGEND>');
      FOR n IN 1 .. par_map_list.COUNT
      LOOP
      FOR var_map_list IN cur_map_list (par_map_list (n))
      LOOP
    htp.print('       <UL>
                       <LI>
                        <LABEL FOR = "WRMF'||
                                      var_map_list.web_raster_map_id||'">
                         <INPUT type = "checkbox"
                                id = "WRMFB'||
                                      var_map_list.web_raster_map_id||'"
                                name = "WRMFB'||
                                        var_map_list.web_raster_map_id||'"
                                value = "'||var_map_list.web_raster_map_id||'"
                                />
                                 Map title: '|| var_map_list.map_title||'<BR>
                                 Sheet number: '||var_map_list.map_sheet_number||'');
                        htp.print('</LABEL>
                       </LI>
                      </UL>');
        END LOOP;
      END LOOP;
         htp.print('</FIELDSET>');
         htp.print('<p>
                     <INPUT TYPE = "submit"
                            NAME = "Display&nbspselected&nbspmaps"
                            VALUE = "Display selected maps" />
                      </FORM>');
    htp.bodyClose;
    END PROCCHECKLIST;Thank you for reading. Kind regards
    Tim

    Dear everyone
    I have now resolved the problems I was having with multiple values and checkboxes, thanks to comments in this thread, read large chucks of Oracle PL/SQL Programming by Steve Feuerstein and suddenly realising where I am going wrong in terms of thinking.
    For a start, I when I was dealing with the multiple values, I was trying to get PL/SQL to pass them out. Of course this is done by the action part of the input form. Although I have not done much web coding, I did know about this. However because I was so engrossed in trying to understand how multiple values work, I didn't relate the two ideas. I even mind mapping the problem and still didn't get it.
    I also did not think to change my the action from post command to get, so that I could see what was coming out. However that would not have made too much of a difference because the other problem I had was related to where sub programmes were declared. The function which received the values was privately declared, and not in the package spec. This meant the web browser could not find the function as that can only make use of the programmes declared publicly.
    Once I made these changes, as well as correcting other minor typing mistakes, the values passed through as expected. The only other mistake I made was to include the name option after the submit input type. In my case I did not need to submit the value of that button. The revised code is as follows. In this version I replaced the function with a procedure that simply prints the checkbox values to screen. I have also made the input form action get, instead of post, so that the values can be seen in the web browser address bar:
    create or replace
    PACKAGE MAPSITE AS
    PROCEDURE MAPS;
    PROCEDURE PROCCHECKLIST
    (par_check_list IN OUT OWA_UTIL.IDENT_ARR
    PROCEDURE PROCDISPLAY
    (maplist IN OUT OWA_UTIL.IDENT_ARR);
    END MAPSITE;
    create or replace
    PACKAGE BODY MAPSITE AS
    --Global variables--
    gvar_mapviewer_host VARCHAR2(56) := 'http://tiger.iso.port.ac.uk:7785/mapviewer/omserver';
    gvar_proc_host VARCHAR2(56) := 'http://tiger.iso.port.ac.uk:7785/www/geg50160';
    gvar_xml_request VARCHAR2(100) :='?xml_request=<?xml version="1.0" standalone="yes"?>';
    --Main calling programming--
    PROCEDURE MAPS AS
    empty owa_util.ident_arr;
    BEGIN
    PROCCHECKLIST (empty);
    END MAPS;
    --create checkboxes--
    PROCEDURE PROCCHECKLIST
    (par_check_list IN OUT owa_util.ident_arr
      AS
       CURSOR cur_map_list IS
        SELECT MT.map_title,
               MI.map_id,
               OMSN.map_sheet_number_id,
               WRMF.web_raster_map_id
         FROM MAP_TITLE MT,
              MAP_INFO MI,
              MAP_SHEET_NUMBER OMSN,
              WEB_RASTER_MAP_FILE WRMF
          WHERE MI.map_title_id = MT.map_title_id
          AND   MI.map_id = OMSN.map_id
          AND   WRMF.map_id = MI.map_id
          AND   WRMF.map_sheet_number_id = OMSN.map_sheet_number_id;
    BEGIN
    htp.htmlOpen;
    htp.headOpen;
    htp.headClose;
    htp.bodyOpen;
    htp.print('<FORM METHOD = "post"
                     ACTION = "'||gvar_proc_host||'.mappackage.procdisplay">');
        htp.print('<FIELDSET>
                     <LEGEND> Select the maps you wish to display </LEGEND>');
      FOR var_map_list IN cur_map_list
      LOOP
    htp.print('       <UL>
                       <LI>
                        <LABEL FOR = "WRMF'||
                                      var_map_list.web_raster_map_id||'">
                         <INPUT type = "checkbox"
                                id = "WRMFB'||
                                      var_map_list.web_raster_map_id||'"
                                name = "maplist"
                                CHECKED = "' ||
                                           par_map_list ||'"
                                value = "'||var_map_list.web_raster_map_id||'"
                                />
                                 Map title: '|| var_map_list.map_title||'<BR>
                                 Sheet number: '||var_map_list.map_sheet_number||'');
                        htp.print('</LABEL>
                       </LI>
                      </UL>');
        END LOOP;
         htp.print('</FIELDSET>');
         htp.print('<p>
                     <INPUT TYPE = "submit"
                            VALUE = "Display selected maps" />
                      </FORM>');
    htp.bodyClose;
    END PROCCHECKLIST;
    ---PROCDISPLAY PROCEDURE---
    PROCEDURE PROCDISPLAY (maplist IN OUT owa_util.ident_arr)
    IS
    BEGIN
    FOR n IN 1..maplist.COUNT
    LOOP
      htp.print('Checkbox value i.e. var_map_list.web_raster_map_id is: ' ||maplist(n)||'
    <P>');
    END LOOP;
    END PROCDISPLAY;
    END MAPSITE;Kind regards
    Tim

  • Populate SQL table with data from Oracle DB in ODI

    Hi,
    I am trying to populate a source SQL table with fields from an Oracle db in ODI. I am trying to perform this using a procedure and I am am getting the following error:
    ODI-1226: Step PROC_1_Contract_Sls_Person_Lookup fails after 1 attempt(s).
    ODI-1232: Procedure PROC_1_Contract_Sls_Person_Lookup execution fails.
    ODI-1228: Task PROC_1_Contract_Sls_Person_Lookup (Procedure) fails on the target MICROSOFT_SQL_SERVER connection Phys_HypCMSDatamart.
    Caused By: weblogic.jdbc.sqlserverbase.ddc: [FMWGEN][SQLServer JDBC Driver][SQLServer]Invalid object name 'C2C_APP.CON_V'.
    My question is what is the best method to populate SQL db with data from an Oracle db? Using a procedure? A specific LKM?
    I found threads referring to using an LKM to populate Oracle tables with data from a SQL table....but nothing for the opposite.
    Any information would help.
    thanks,
    Eric

    Hi Eric,
    If using an Interface, I would recommend the LKM SQL to MSSQL (BULK) knowledge module. This will unload the data from Oracle into a file, then bulk load the staging db on the target using a BULK INSERT.
    Regards,
    Michael Rainey

  • Problem with query for Oracle

    Hello Experts,
    I'm tryng to develop my first application for EP (v7 SP12) with NWDS (without NWDI).
    This application has to read and write data in the EP DB (oracle v10).
    I'm using:
    <u>a Dictionary Project</u> (define the DB Tables)
    <u>a Java Project</u> (define class as DAO, DBManager etc)
    <u>a Library Project</u>
    <u>an EJB Project</u>
    <u>an EAR Project</u>
    With these projects I can deploy a <u>webService</u> in my EP server.
    BUT I have some problem with a query that I'm tryng to sent to my DB through a DAO Class called by my WebService.
    The query is simple and correct but it does not work...
    This is the error message returned (the query id in bold)
    (column names: GIORNO, NOMEDITTA, NOMEAREA, NOMESETTORE)
    <i>HTTP/1.1 500 Internal Server Error
    Connection: close
    Server: SAP J2EE Engine/7.00
    Content-Type: text/xml; charset=UTF-8
    Date: Fri, 21 Sep 2007 14:29:57 GMT
    Set-Cookie: <value is hidden>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>java.sql.SQLException: com.sap.sql.log.OpenSQLException: The SQL statement <b>"SELECT NOMESETTORE, MIN(? - "GIORNO") AS GIORNI FROM SRS_DATEINFORTUNI WHERE NOMEDITTA = ? AND NOMEAREA= ? GROUP BY NOMESETTORE ORDER BY NOMESETTORE"</b> <u>contains the syntax error[s]: - 1:25 - the arithmetic expression >>? - "GIORNO"<< contains a host variable (parameter marker)</u></faultstring><detail><ns1:getGiorniSettori_com.akhela.giorniSenzaInfortuni.ejb.exception.GiorniSenzaInfortuniException xmlns:ns1='urn:GiorniSenzaInfortuniWSWsd/GiorniSenzaInfortuniWSVi'></ns1:getGiorniSettori_com.akhela.giorniSenzaInfortuni.ejb.exception.GiorniSenzaInfortuniException></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope></i>
    The variable '?' is the today date, the difference <b>"(?-GIORNO)"</b> is an int..
    Moreover in my DAO class the query is <b>"SELECT NOMESETTORE, MIN(? - GIORNO) AS GIORNI FROM SRS_DATEINFORTUNI WHERE NOMEDITTA = ? AND NOMEAREA= ? GROUP BY NOMESETTORE ORDER BY NOMESETTORE</b>", instead in the error message is reported <b>MIN(? - "GIORNO")</b>...
    We have tryed also with alternative query, for example we used <b>"MIN(SYSDATA - GIORNO)"</b> but <b>SYSDATA</b> was interpreted as column name and  not found....
    Any help???
    Best Regards

    Hi, I found something about the Host Variable (http://help.sap.com/saphelp_nw70/helpdata/en/ed/dbf8b7823b084f80a6eb7ad43bdbb9/content.htm), there explain that if you want to use an host variable you have to put ':' as prefix..
    My problem is that <u>I need to extract the minimum of the subtraction between two dates:</u>
    Query <b>MIN(? - GIORNO)</b> --> <i>Error: the arithmetic expression >>? - "GIORNO"<< contains a host variable (parameter marker)</i>
    So I tried to use the ':' as indicated in the manual..
    <b>MIN:(? - GIORNO)</b> --> - <i>SQL syntax error: the token ":" was not expected here
                   - expecting LPAREN, found ':'</i>
    <b>MIN(:(? - GIORNO))</b> --> <i>- 1:25 - Open SQL syntax error: :PARAMETER not allowed
                   - 1:26 - SQL syntax error: the token "(" was not expected here
                   - 1:26 - expecting ID, found '('</i>
    Then I tried to avoid the MIN() function and I tried to do just the subtraction:
    <b>? - GIORNO</b> --><i> - 1:21 - the arithmetic expression >>? - "GIORNO"<< contains a host variable (parameter marker)</i>
    <b>:(? - GIORNO)</b> --> <i>- 1:21 - Open SQL syntax error: :PARAMETER not allowed
                - 1:22 - SQL syntax error: the token "(" was not expected here
                - 1:22 - expecting ID, found '('</i>
    <b>'2007-09-24' - GIORNO</b> --> <i>- 1:34 - SQL syntax error: first argument of operator "-" must be a number, date/time or interval
                     - 1:43 - SQL syntax error: arguments of operator "-" do not have correct types
                     - 1:43 - SQL syntax error: derived columns in SELECT list with AS must be values</i>
    <b>GIORNO - GIORNO</b> --> <i>- 1:21 - the group by list and the select list are inconsistent: the column >>"GIORNO"<< is neither grouped nor aggregated
                  - 1:30 - the group by list and the select list are inconsistent: the column >>"GIORNO"<< is neither grouped nor aggregated</i>
    Why these parts of query are not accepted???
    I don't understand why... I hope you can help me.
    Best Regards
    Alessandro

  • Setting isolation level with JDriver for Oracle/XA

    edocs (http://e-docs.bea.com/wls/docs70/oracle/trxjdbcx.html#1080746) states that,
    if using jDriver for Oracle/XA you can not set the transaction isolation level
    for a transaction and that 'Transactions use the transaction isolation level set
    on the connection or the default transaction isolation level for the database'.
    Does this mean that you shouldn't try to set it programatically (fair enough)
    or that you can't set it in the weblogic deployment descriptor either? Also anybody
    got any idea what the default is likely to be if you are using an Oracle 9iR2
    database? Is this determined by some database setting?

    IJ wrote:
    edocs (http://e-docs.bea.com/wls/docs70/oracle/trxjdbcx.html#1080746) states that,
    if using jDriver for Oracle/XA you can not set the transaction isolation level
    for a transaction and that 'Transactions use the transaction isolation level set
    on the connection or the default transaction isolation level for the database'.
    Does this mean that you shouldn't try to set it programatically (fair enough)
    or that you can't set it in the weblogic deployment descriptor either? Also anybody
    got any idea what the default is likely to be if you are using an Oracle 9iR2
    database? Is this determined by some database setting?The system should honor the setting defined in the deployment descriptor,
    however, for oracle it may not be helpful to change it. Oracle provides two
    isolation levels. The default is always READ_COMMITTED. The other
    setting is SERIALIZABLE, but this hurts performance, and is also problematic
    in the way oracle implements it. For instance, even if you set SERIALIZABLE,
    oracle will not lock read data. It will allow other transactions to read and/or
    alter data trhat another ongoing SERIALIZABLE transaction has read. The
    only way to really lock read data in oracle is to issue oracle-specific SQL in
    your select: "SELECT ..... FOR UPDATE".
    All in all, you should collect a strong case for why you can't proceed with
    READ_COMMITTED first. Then you should research oracle's recommendations
    (and their problem record) with SERIALIZABLE.
    Joe Weinstein at BEA

  • Issue with .profile for oracle 9i and 10g

    Here I have six oracle 9i databases on one box. I am going to upgrade five of them to oracle 10g and want to keep one database RCAT in oracle 9i for one or two week.
    So, when I do upgrade I have to setup oracle home for 10g and also profile for oracle user for 10g (correct me if I m wrong). But now I want one database RCAT on oracle 9i. How can I take care of this.
    I mean how I will handle profile and all other thing for oracle 9i and 10g at the same time.
    Thanks,
    Vishal

    Install 10g under the same OS user as 9i, of course on a different Oracle Home. Then you configure your .profile consequently. Just as an example, this is my .bash_profile with 10g and 11g with the same oracle OS user :
    [oracle@linux5 ~]$ cat .bash_profile
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    export EDITOR=vi
    export ORACLE_BASE=/home/oracle/base
    umask 022
    o10()
    {       export ORACLE_SID=db102
            export ORACLE_HOME=$ORACLE_BASE/OraHome10
            export LD_LIBRARY_PATH=$ORACLE_HOME/lib
            export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
            export TNS_ADMIN=$ORACLE_BASE/OraHome11/network/admin
            export PS1='[\u@\h_10 \W]\$ '
    o11()
    {       export ORACLE_SID=db11
            export ORACLE_HOME=$ORACLE_BASE/OraHome11
            export LD_LIBRARY_PATH=$ORACLE_HOME/lib
            export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
            export PS1='[\u@\h_11 \W]\$ '
    s()
    {       sqlplus / as sysdba
    asm()
    {       export ORACLE_SID=+ASM
    db10()
    {       export ORACLE_SID=db102
    db11()
    {       export ORACLE_SID=db11
    asm10()
    {       export ORACLE_SID=asm10
    [oracle@linux5 ~]$

  • Problems with TDP for Oracle

    Hello, I'm having problems setting up TDP for Oracle. When I run a backup, I get the following error stack from RMAN:
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03009: failure of allocate command on t1 channel at 02/21/2007 09:40:52
    ORA-19554: error allocating device, device type: SBT_TAPE, device name:
    ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
    IBM AIX RISC System/6000 Error: 106: Reserved errno was encountered
    Additional information: 7011
    ORA-19511: Error received from media manager layer, error text:
    SBT error = 7011, errno = 106, sbtopen: system error
    I'm running AIX 5.2, TDP 5.3, level 3
    Oracle version 9.2.0.4
    My libobk.a file is linked in the following manner
    libobk.a@ -> /usr/lib/libobk64.a
    /usr/lib/libobk64.a@ -> /usr/tivoli/tsm/client/oracle/bin64/libobk64.a
    I'm not sure if the version of AIX i'm running is 64 bit or not, does anyone know how I can check this?
    Oh and the sbtio.log file is empty.

    Check this website for the error stack:
    http://www-1.ibm.com/support/docview.wss?uid=swg21197242
    This command will tell you 32 or 64 bit, more exactly when it is 32bit you will see bos.64bit not installed.
    lslpp -l bos.64bit
    Werner

  • Sun Solaris 10,Upgrade 8 or higher,having issues with VxFS,for Oracle 11gr2

    A while ago, we tried doing a prototype upgrade of our main Oracle 10g db to Oracle 11gr2.
    The OS on which our Oracle 10g is running is Sun Solaris 10, upgrade 4.
    According to Oracle 11gr2 documentation, we need Sun Solaris 10, upgrade 6 or higher for Oracle 11g2.
    The filesystem we are using is VxFS, Veritas File System.
    According to our system administrator, we had issues , making Sun Solar 10, upgrade 8 , work with the VxFS filesystem.
    I was wondering if anybody is running Oracle 11g2 on Sun Solaris 10 upgrade 6 or higher with VxFS file system.
    At present, our Oracle db upgrade project is on a hold, because of the above issue. So your help on this , can really help us in figuring out if there is an issue between VxFS filesystem and Sun Solaris 10 OS.
    Thanks
    Ashish

    Hi Ashish,
    We are not running Veritas Cluster file system.
    We tried moving our Oracle 10g r2 db on ZFS ,before doing the upgrade and performance on ZFS was worst.
    ZFS has certain memory parameter setting. If you did not configure that then ZFS will eat your complete system memory.
    My system administrator, has gotten a copy of Solaris 10 upgrade 9 and will try that with VxFS.
    I was curious to find out if folks are running Oracle 11g on Sun Solaris 10 with VxFS file system and if they had experienced any issue.If you can Install Vxfs on Oracle Soalris 10 U9, then according to me there sholudn't be any limitations for an oracle database.
    Recently i installed Oracle database 11.2.0.2 on one of my test server. I have created two databases - one on ZFS and another on ASM.
    Refer:
    http://appsdbaworkshop.blogspot.com/2010/10/installation-of-11202-on-oracle-solaris.html
    We dont have any performance issues. We are testing it for the performance benchmarks on both of the filesystem.
    If you can Install Vxfs on Oracle Soalris 10 U9, then according to me there sholudn't be any limitations for an oracle database.
    Regards,
    X A H E E R

  • Please provide real time scenario for when we use object type in PL/SQL.

    Hi Experts,
    When we use this kind of code in PL/SQL block.
    CREATE OR REPLACE TYPE sample_object IS OBJECT
    (id       NUMBER
    ,name     VARCHAR2(30));
    CREATE OR REPLACE TYPE sample_table IS TABLE OF sample_object;I have read some docs ,but I didn't get any information where exactly we use this.
    Please provide one real time scenario with an example.
    How this is different from record.
    Thanks in advance.

    Hi,
    For an example please have a look at this....
    CREATE OR REPLACE TYPE FML_DAT_ITEMS_OBJ AS OBJECT
                      (F_NAME VARCHAR2 (20), L_NAME VARCHAR2 (20));
    CREATE OR REPLACE TYPE FML_DAT_ITEMS_FTAB AS TABLE OF FML_DAT_ITEMS_OBJ;
    CREATE OR REPLACE FUNCTION GET_FML_ITEMS_DAT (PFML_NR IN NUMBER)
       RETURN FML_DAT_ITEMS_FTAB
       PIPELINED
    AS
       OUT_REC   FML_DAT_ITEMS_OBJ;
    BEGIN
       SELECT FML_DAT_ITEMS_OBJ ('peter', 'zwan') INTO OUT_REC FROM DUAL;
       FOR I IN 1 .. PFML_NR
       LOOP
          PIPE ROW (OUT_REC);
       END LOOP;
    END GET_FML_ITEMS_DAT;To view the o/p:
    SELECT * FROM TABLE (get_fml_items_dat (5));
    F_NAME, L_NAME
    peter,zwan
    peter,zwan
    peter,zwan
    peter,zwan
    peter,zwan Refer these links to know more about the topic...
    http://www.oracle-developer.net/display.php?id=207
    http://www.oracle-base.com/articles/misc/pipelined-table-functions.php

  • Getting varchar objects as "???" while using struct for oracle object type

    Hi all.
    I have a problem whith VARCHAR values which is returned from an oracle function. The function returns an oracle type and I get it using STRUCT. I can get all non VARCHAR values of the TYPE like NUMBER and TIME without any problem. But when I get VARCHAR values, they all come as if equal to"???". I called the database function in TOAD and everything works perfect. It seems that somewhere in between we loose the information. Has anyone encountered such a strange problem?
    Part of the code look like:
    CallableStatement callState = null;
              ResultSet rs = null;
              UOAReturnType result= new UOAReturnType();
              try
                   callState = getConnection().prepareCall("{?=call Call.UACBS.GETREDL(?)}");
                   callState.registerOutParameter(1, OracleTypes.STRUCT,"CALL.TYPE_REDL_RO");
                   callState.setString(2,msisdn);
                   callState.execute();
                   Struct RedlRoStrct = (Struct)callState.getObject(1);
                   Object[] redlRo = RedlRoStrct.getAttributes();
                   Struct redlStruct = (Struct)redlRo[0];
                   Object[] redl =null;
                   if(redlStruct!=null){
                        redl = redlStruct.getAttributes();
                        result.setMsisdn(redl[0].toString());
                        try {
                             result.setTime(UtilDate.getDate(redl[1].toString(),dateFormat,custLocale));
                        } catch (NullPointerException e2) {
                             result.setTime(null);
                             e2.printStackTrace();
                        result.setReason(Integer.parseInt(redl[2].toString()));
                        result.setSource(redl[3].toString());
                   Struct opReturnStruct = (Struct)redlRo[1];
                   Object[] opReturn = opReturnStruct.getAttributes();
                   result.setResultCode(Integer.parseInt(opReturn[0].toString()));
                   result.setResultDescription(opReturn[1].toString());Any idea will be appreciated.
    Thanks.......

    Hi,
    I don't think it is a java problem.You can see time and number types because the characters are digits. My guess is that it has something to do with some settings on the client. Try to have the NLS_LANG environment variable appropriately set. Also try invoking your test script from sqlplus to see if the results actually work.
    Kiros

Maybe you are looking for