Updating Object Type Columns with SQL

Please note that is a re-post from a different forum. I thought I would try this forum as reading through it, it made more sense to post here. Problem:
I am trying to update a column inside a Nested Table Type in my Table.
This is what I got from some documentation I found from Oracle.
UPDATE TABLE(SELECT PROGRAMS FROM TB_ITEM_MASTER WHERE ITEM_NO_ID =1748) IM
SET IM.PROGRAM_ID = 1;
WHERE IM.ITEM_NO_ID = 1748;
Where PROGRAM_ID is a field from the nested table (ITEMS_IN_PROGRAMS_NT) and ITEM_NO_ID is the Primary Key in my TB_ITEM_MASTER table. When I run this it gives me an error of:
ORA-22908: REFERENCE TO NULL TABLE VALUE
I assume this is because PROGRAM_ID is currently NULL, and when it pulls the record back, I am pulling a NULL value. Currently all the values will be NULL in the table, but I would like to create a UPDATE Statement that I will call that will update that value, from NULL to whatever ID.
Here are my def'n's of all my objects for this problem:
--Object Type def'n
CREATE OR REPLACE TYPE ITEMS_IN_PROGRAMS_TY AS OBJECT(
PROGRAM_ID NUMBER(38));
--Object Type def'n for Nested Table
CREATE OR REPLACE TYPE ITEMS_IN_PROGRAMS_NT
AS TABLE OF ITEMS_IN_PROGRAMS_TY;
--Table def'n
CREATE TABLE TB_ITEM_MASTER
(ITEM_NO_ID NUMBER(38) NOT NULL,
ITEM_NO VARCHAR2(75) NOT NULL,
NOMENCLATURE VARCHAR2(100) NULL,
PROGRAMS DMISDBA.ITEMS_IN_PROGRAMS_NT NULL);
Can someone please help me....I am pulling my hair out on this problem!!! All I want to do is update the column inside a Nested Table. This can not be that hard!!!

Save your hair...
SQL> CREATE OR REPLACE TYPE items_in_programs_ty AS OBJECT(
  2  program_id NUMBER(38));
  3  /
Type created.
SQL> CREATE OR REPLACE TYPE items_in_programs_nt
  2  AS TABLE OF items_in_programs_ty;
  3  /
Type created.
SQL> CREATE TABLE tb_item_master
  2  (item_no_id number(38) not null,
  3  item_no varchar2(75) not null,
  4  nomenclature varchar2(100) null,
  5  programs items_in_programs_nt )
  6  NESTED TABLE programs STORE AS nested_programs
  7  /
Table created.
SQL>
SQL> INSERT INTO tb_item_master (item_no_id, item_no, nomenclature)
  2  VALUES (1748, 'APC/1748', 'Gizmo')
  3  /
1 row created.
SQL> UPDATE tb_item_master tmi
  2  SET    tmi.programs =  items_in_programs_nt(items_in_programs_ty( 1))
  3  WHERE  tmi.item_no = 'APC/1748'
  4  /
1 row updated.
SQL>
SQL> Cheers, APC

Similar Messages

  • Updating xml type column

    Hi,
    I have a xml type column with content as follows
    <?xml version="1.0" encoding="utf-8"?>
    <PartInformation PartNumber="4393">
    <Maintenance />
    <Details>
    <Specs PartNumber="4393">
    <Type Code="K"></Type>
    </Specs>
    </Details>
    </PartInformation>
    <PartInformation PartNumber="4395">
    <Maintenance />
    <Details>
    <Specs PartNumber="4395">
    <Type Code="Z"></Type>
    </Specs>
    </Details>
    </PartInformation>
    I want to update the PartNumber="4393" to PartNumber="5789" for every occurrence .
    What is the easiest way to do it?
    Thanks

    Hi,
    Something like this?
    UPDATE your_table
    SET xmlcol = updatexml(xmlcol,'//*[@PartNumber="4393"]/@PartNumber','5789')
    WHERE ...

  • 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

  • How to Update a particular column with custom SQL in JHeadstart

    Hi Friends,
    I was trying to keep an update SQL statement in VO (missing right Parenthesis exception is thrown)
    Please to let you know about my Requirement.
    I have a column in Sales_Person Table "TARGET' and in Sales_Admin Table "INCENTIVE"
    So Admin will allot a particular Amount in Incentive column for all the sales. (i.e globally for one and all)
    When a Sales_Person enter a target of some number say 80 in the Target field.
    while saving i want to deduct the target from incentive and the result must be update in Incentive column.
    can you please suggest me where should i keep this functionality
    Can you please help me out in solving this issue.
    Thanks in advance.
    Rahul

    Rahul,
    You can do this in the doDMl method of your Entity Object.
    See this white paper:
    http://www.oracle.com/technology/products/jdev/collateral/papers/10131/businessrulesinadfbctechnicalwp.pdf
    If you have follow-up questions, please use the JDeveloper forum, since your question is not related to JHeadstart.
    Steven Davelaar,
    JHeadstart Team.

  • Problem with UDF updation - Object type 46

    Hi Experts,
    Scenario :
    For printing the amounts(in words- Indian format) in Cheque and marketing documents, we created UDFs in Title of marketing documents and outgoing payments.
    Then created a function in the DB for convertion of amounts into words and invoked it from  SBO_SP_TransactionNotification for object type '46' (Outgoing payment) and for transaction type 'A'.
    We tried it  with Out going payments
    Problem :
    Initially It was not working at all. When we removed the  transaction type condition the amount got updated on updation of existing records. Still It is not updating the UDFs while adding a new outgoing payment.
    We inserted the values like object type , transaction type etc into a temp table for testing from SBO_SP_TransactionNotification .
    The value we got for Out going payment addition is
    Object type: 30 and transaction type : A (Why this is 30 while adding outgoing payment?)
    The value we got for Out going payment modification is
    Object type: 46 and transaction type :U
    Please Help us on this
    I don't know whether this is the right forum or not.
    We are using SAP Business One 2007 B PL 13
    Thanks and regards
    Ajith G
    Edited by: Ajith G on Oct 5, 2009 11:48 AM

    Hi,
    Step to have check print in Indian format
    1)create function
    2)create user field in that master table
    3)make user define query
    declare @Doc_total numeric (19,6)
    set @Doc_total= (SELECT $[ORPC.DocTotal])
    declare @F100 varchar(20)
    declare @DocCurr varchar(20)
    SET @DocCurr= (SELECT $[ORPC.DocCur])
    set @F100= (SELECT Chk100Name FROM OCRN WHERE CurrCode = @DocCurr)
    select REPLACE(SBO_DB.dbo.AmountToWords (@Doc_total), 'Paise',  @F100)
    4)save above query and define that query in user field by shift+F2
    i hope u may know next step
    Kevin

  • Invalid table name  error when updating object in collection using SQL

    Hi,
    I have pl/sql code where I am selecting a object from a collection using sql select query. I am processing this record and now I want to update the collection with the new object. ie. ensure that the object that was fetched be removed and this new one be added.
    considering my_ot is the object type and my_tt is the table type.
    DECLARE
    my_col my_tt;
    my_col1 my_tt
    my_var my_ot;
    my_var2 VARCHAR2(10);
    BEGIN
    // populating my_col1 with select query
    //populating my_col with select query
    FOR my_col1.FIRST .. my_col.LAST LOOP
    //populating my_var2
    BEGIN
    SELECT my_ot(c.field1, c.field2 ,c.field3) INTO my_var FROM TABLE(my_col) c WHERE c.field3 = my_var2
    //processing the field my_VAR
    UPDATE TABLE(my_col) c SET c.field1 = my_var.field1 , c.field2 = my_var.field2 , WHERE c.field3 = my_var.field3;
    EXCEPTION WHEN NO_DATA_FOUND
    my_col.EXTEND;
    my_col(my_col.LAST) := // new my_ot object
    END;
    END LOOP;
    Here, when compiling the update query is not being compiled. I am getting a error 'invalid table name'. Is there any way to modify an object in the collection without knowing its index?
    If not, is it possible to find the index of a object in the collection in select query?
    Thanks in advance
    Paddy

    Hi,
    Is there any way to find the index of a object in the collection? Then I will simply replace the object at that index, right!
    Thanks
    Paddy

  • How can I update a Site Column with the content of an array with javascript CSOM?

    I'm relative new to Sharepoint 2013, I'm trying to update the content of a Site column with the content of an array, I can retrieve and visualize the content of my site column, the user is able to change and save the necessary part and the changes are
    saved into an array, now I have to update the content of the site column with the content of the array, but for some kind of reasons I can't accomplish that, any suggestion/example? This is my code so far to retrieve, visualize the site column and store the
    mofication into my array.
        <body>
                <select id="dropdown" name="dropdown" onchange="optSelect()">
                    <option value="EngineType_Cylinders">EngineType_Cylinders</option>
                    <option value="EngineType_EngineCycle">EngineType_EngineCycle</option>
                    <option value="EngineType_EngineFamily">EngineType_EngineFamily</option>
                    <option value="EngineType_Euro">EngineType_Euro</option>
                    <option value="EngineType_FamilyEvolution">EngineType_FamilyEvolution</option>
                    <option value="EngineType_GasEmissionLevel">EngineType_GasEmissionLevel</option>
                    <option value="EngineType_Power">EngineType_Power</option>
                    <option value="EngineType_PowerSupply">EngineType_PowerSupply</option>
                    <option value="EngineType_Use">EngineType_Use</option>
                </select><br />
                <textarea id="textareadisplay" rows="25" cols="23"></textarea><br />
                <input type ="button" value="Update values" onclick="addItemsToColumns()" />
            </body>
    My Javascript
        $(function () {
            SP.SOD.executeOrDelayUntilScriptLoaded(Function.createDelegate(this, function () {
               var select = document.getElementById('dropdown').value;
                console.log(select);
                getSiteColumns(select);
            }), 'SP.js');
        var fieldChoice;
        var choices;
        var addFields = [];
        var slc;
        var clientContext;
        function optSelect() {
            slc = document.getElementById('dropdown').value;
            getSiteColumns(slc);
        function getSiteColumns(selection) {
           clientContext = SP.ClientContext.get_current();
            if (clientContext != undefined && clientContext != null) {
                var web = clientContext.get_web();
                fieldChoice = clientContext.castTo(web.get_availableFields().getByTitle(selection), SP.FieldChoice);
                clientContext.load(this.fieldChoice);
                clientContext.executeQueryAsync(Function.createDelegate(this, this.OnLoadSuccess), Function.createDelegate(this, this.OnLoadFailed));
        function OnLoadSuccess(sender, args) {
            choices = fieldChoice.get_choices();
            var textarea = document.getElementById("textareadisplay");
            textarea.value = choices.join("\n");
        function OnLoadFailed(sender, args) {
            alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
        function addItemsToColumns() {
            clientC = SP.ClientContext.get_current();
            var arrayForUpdate = $('#textareadisplay').val().split('\n');
            fieldChoice.set_item(, arrayForUpdate);
            fieldChoice.update();
            clientContext.executeQueryAsync(function () { }, function () { });
        function OnUpdateSuccess(sender, args) {
            var newchoices = fieldChoice.get_choices();
    My problem is on the function addItemsToColumns() please help! Thanks in advance.

    Let's look at your stylesheet -
    <style type="text/css">
    body {
    background-image: url(assets/images/Business%20Men%20In%20Reception%20Col.2.jpg);
    background-repeat: no-repeat;
    background-color: #003;
    margin-left:auto;
    margin-right:auto;
    position: relative;
    width: 960px;
    It's a good idea not to use spaces or any punctuation in your filenames when working for the web.
    #header {
    margin-left:auto;
    margin-right:auto;
    position: relative;
    width: 960px;
    #heading {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 36px;
    font-style: italic;
    font-variant: normal;
    margin-left:auto;
    margin-right:auto;
    There's no need to specify the default values (font-variant:normal) or to specify auto margins for any block element without an explicitly defined width. And wouldn't it make more sense to put the font style on the body tag, where it will inherit into the rest of the page than to restate it as you have done in the next rule?
    #bodytext {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 18px;
    line-height: 25px;
    font-variant: normal;
    width: 300px;
    #container {
    width: 960px;
    position: relative;
    margin-left:auto;
    margin-right:auto;
    .rightimg {
    float: right;
    margin-left: auto;
    padding-right: 40px;
    #heading #navbar ul li {
    padding: 30px;
    </style>
    Margin-left:auto can't work without knowing what the width of the element is....  Keep your CSS lean and targeted - it will help you to debug your layouts.

  • I want to update  timestamp(3) column with respect to varchar2

    Hi all,
    I have a date field column with varchar2 as datatype :
    create table t1 (id number,date1 varchar2(35))
    insert into (1,' 3/13/2011 10:22 AM');
    insert into (2,' 3/14/2011 10:22 AM');
    insert into (3,' 3/15/2011 10:22 AM');
    I want to update table2
    create table t1 (id number,date1 timestamp(3))
    insert into (1,' ');
    insert into (2,' ');
    insert into (3,' ');I want to update t2 with date column in t1
    can any one help me
    Thanks in advance!!!!!

    Hi,
    846773 wrote:
    Hi all,
    I have a date field column with varchar2 as datatype : That's not a very good idea. You should always use a DATE or TIMESTAMP column for dates.
    create table t1 (id number,date1 varchar2(35))
    insert into (1,' 3/13/2011 10:22 AM');Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful.
    Test them and make sure they work before you post them. You forgot the table name (after the keyword INTO).
    insert into (2,' 3/14/2011 10:22 AM');
    insert into (3,' 3/15/2011 10:22 AM');
    I want to update table2
    create table t1 (id number,date1 timestamp(3))This is the same name you used for the other table. I'll assume you meant to say t2 here, not t1.
    insert into (1,' ');Don't try to insert a string (such as ' ') into a TIMESTAMP column, You can INSERT a literal NULL, or simply not INSERT anything into that column.
    insert into (2,' ');
    insert into (3,' ');I want to update t2 with date column in t1Use TO_TIMESTAMP to convert the string into a TIMESTAMP:
    MERGE INTO     t2     dst
    USING  (
               SELECT  id
            ,        TO_TIMESTAMP ( date1
                              , 'MM/DD/YYYY HH:MI AM'
                       )      AS ts
            FROM    t1
           )          src
    ON     (src.id     = dst.id)
    WHEN MATCHED THEN UPDATE
    SET     dst.date1 = src.ts
    ;

  • UPDATE value in column with value in SAME TABLE

    Hi all,
    Here's my issue...
    I have a table which records all incidents for a person.
    The table looks something like this:
    tbl_connect(person_Id NUMBer,
    OLD_ID VARCHAR2(24),
    CASE_NUMBER     VARCHAR2(10),
    CASE_TYPE     VARCHAR2(10),
    PERSON_ROLE     VARCHAR2(30),
    INCIDENT_TYPE     VARCHAR2(40));
    The table is populated from a source table with all fields except person_id. Person_id is a sequence number that gets generated if the person comitting the incident is a NEW PERSON to our system. OLD_Id is the unique identifier between the source table and tbl_connect to identify a person.
    The problem: If an existing person commits a new incident, a new record will be inserted into tbl_connect without PERSON_ID. Since the person already is in the database the person_id already exists in tbl_connect for that person. I now need to UPDATE person_id column with the person_id that already exists for this person. How can i achieve this.
    Ive been trying all sorts of update queries but nothing seems to work. ANy help will be appreciated. Thanks in advance.

    Frank,
    Thanks for the speedy reply. Here is a sample table.
    I know it's a bit confusing. The data that is being dumped into this table is information from a old system. The OLD_ID is in here because it is the relationship between this table and the old table. PERSON_ID is new to this system to identify a person uniquely. That is why i need them both in this table for right now.
    So say my tbl_connect got populated with new info from the old table. As you can see, old_id=567A has comitted another incident. Since he already exists in tbl_connect, now i need to update person_id with the value of 1. Does that make sense now????? If old_id did not exist, all i would do is insert a new row and set person_id to the next sequence number.
    TBL_CONNECT
    PERSON_ID OLD_ID      CASE_NUMBER CASE_TYPE          
    1     567A     12345          IR          
    1     567A     15236          MV
         567A     98547          IR<--newly inserted record of same person

  • Is it possible to get object type name  with help of key field?

    can any one tell me is it really possible to get the object type name if i have only key field,
    are there any tables which store the object type names & keyfield.  or there are any functionmodue which gives object type name by entering keyfield.

    Hello,
    If the PO has workflows associated with it, there is a table SWIWIOBJCT which stores details of the workitem, object key , object type details.
    If you input the object key to this table ( For ex: PO number in this case) , it will give you the corresponding object type for the object key for Workitem type F.
    Thanks,
    Sowmya Arni

  • Can we create an associative array of Object type Column

    Hi All,
    I have a scenario where there are many PLSQL Types passed as IN and OUT params in a procedure. Since the Java cannnot access these types, we've plannned to create Object types.
    However the can we create one Object type as below:
    create or replace type T_EMP_REC as object
    emp_id number(8),
    dept_id number(8),
    emp_name varchar2(50),
    Then now I want to create an array of T_EMP_REC.emp_id and others respectively. Is this possible.
    The reason for doing this is, that we may get many emp_id, dept_id and emp_name for a condition and hence pass on the same to Java application.
    Please share your thoughts to achieve for such scenario. Any pseudo or code logic is much helpful.
    Regards,

    Hi,
    Sorry, this is forum is intended only for SQL Developer tool questions.
    If you wish to pursue your question, mark this thread as answered and repost in the SQL and PL/SQL forum:
    PL/SQL
    Thanks,
    Gary

  • 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.

  • Rows to be displayed as Columns with SQL

    I have a select statment
    SQL> SELECT T.CODE,T.DESCRIPTION from tmp t;
    CODE DESCRIPTION
    1 1-1
    1 1-2
    1 1-3
    1 1-4
    I want with SQL not SQL*PLUS nor Cursors to see the output of my SQL statment as
    1 1-1 1-2 1-3 1-4
    Please Help

    You could try something like that :
    SQL> with tbl as
      2  (select 1 code, '1-1' descr from dual union all
      3   select 1 code, '1-2' descr from dual union all
      4   select 1 code, '1-3' descr from dual union all
      5   select 1 code, '1-4' descr from dual) -- end of data sample
      6  select code, max(sys_connect_by_path(descr,' ')) keep (dense_rank last order by length(sys_connect_by_path(descr,' '))) descr
      7  from   tbl
      8  connect by code = prior code and descr > prior descr
      9  group by code
    10  /
          CODE
    DESCR
             1
    1-1 1-2 1-3 1-4Nicolas.

  • 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): @|

  • How to load selected column with sql loader

    Hi all
    I want to load only few columns from a datafile not all columns and i don't know how to do from SQL LDR.
    I know we can use position but the data is not fixed length.
    I'm working with Oracle 11g and Linux OS.
    Here is an example of my data file and table.
    Data file is and the field is separated by | :
    3418483|VOU|20120609090114|555208363|0|2858185502059|1000|0||
    3418484|SR|20120609090124|551261956|0|4146314127759|200000|0||
    SQL> desc TBL1
    Name                                      Null?    Type
    CTYPE                                              VARCHAR2(5)
    BDATE                                              DATE
    PARTNUM                                             VARCHAR2(60)
    SERIALNO                                           NUMBER
    FVALUE                                             NUMBER
    I want to have:
    SQL> select * from TBL1
    CTYPE     BDATE          PARTNUM          SERIALNO          FVALUE
    VOU     09/06/2012     555208363     2858185502059          1000
    SR     09/06/2012     551261956     4146314127759          200000Thank you.

    look at FILLER
    http://www.orafaq.com/wiki/SQL*Loader_FAQ#Can_one_skip_certain_columns_while_loading_data.3F
    --add sample
      num1 FILLER,
      ctype,
      bdate "to_date(:bdate, 'YYYYMMDDHH24MISS')",
      PARTNUM,
      num2 FILLER,
      SERIALNO,
      FVALUE, 
      num3 FILLER
      )Edited by: AlexAnd on Jun 9, 2012 4:29 AM

Maybe you are looking for

  • Why am I being charged for data when connected to wifi AND not using my phone?!

    WHY am I being charged for data that I'm not using? At times when I'm asleep AND my phone is connected to wifi?!  This happens at really specific, alternating times like 9:54 pm every day, or 12:01 am, 6:01 am and then 12:01pm and 6:01pm. When I call

  • Adobe photoshop 13 organiser will not sign in

    Adobe PS 13 on Mac Editor is signed in I can sign in on Web Organiser sign in fails   I get " Sign in failed. Please check your connection and try again" I am connected as I can log in on web my Adobe account Steve

  • Problems installing Java 7u2 on Windows XP

    I have seen lots of posts on this issue but no real solution. I was able to installed jdk-7u1-windows-i586.exe just fine but jdk-7u2-windows-i586.exe does nothing. I have run it from the command line, and by double clicking the icon but nothing, no w

  • 10.2.0.4 patchset

    hello friends Can I apply patch p7584866_10204_Win32 on a 10.2.0.1 DB, windows 32bit. ? SQL> select * from v$version; BANNER Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod PL/SQL Release 10.2.0.1.0 - Production CORE 10.2.0.1.0 Produ

  • Resize photos in "User Photo Maintenance"

    Hi everybody, I'm using the User photo maintenance page to upload photos for a user. But the format 130*100px is very strict. Isn't there a possibility to resize the picture when it is not conforming these dimensions? Thank you regards Wouter