DBMS_SQL cannot get the value of static column.

The code below, it works fine. But when the query is modified as
 select id, name, 'NOT', date from example_table
the * 'NO' * cannot be retrieved by DBMS_SQL. COLUMN_VALUE.

The result looks like

1, Tom, 06/03/2013
1, Jack, 03/06/2013
1, Pete, 03/06/2013

But I want that:

1, Tom, NO, 2013/06/03
1, Jack, NOT 2013/06/03
1, Pete, NO, 2013/06/03

Can someone test this and have a solution for this?
        DECLARE
           v_curid    NUMBER;
           v_desctab  DBMS_SQL.DESC_TAB;
           v_colcnt   NUMBER;
           v_name_var  VARCHAR2(10000);
           v_num_var   NUMBER;
           v_date_var  DATE;
           v_row_num    NUMBER;
            p_sql_stmt VARCHAR2(1000);
        BEGIN
            v_curid := DBMS_SQL.OPEN_CURSOR;
            p_sql_stmt :='SELECT * FROM emp';
            DBMS_SQL.PARSE(v_curid, p_sql_stmt, DBMS_SQL.NATIVE);
           DBMS_SQL.DESCRIBE_COLUMNS(v_curid, v_colcnt, v_desctab);

           -- Define columns:
           FOR i IN 1 .. v_colcnt LOOP
            IF v_desctab(i).col_type = 2 THEN
                DBMS_SQL.DEFINE_COLUMN(v_curid, i, v_num_var);
                ELSIF v_desctab(i).col_type = 12 THEN
                DBMS_SQL.DEFINE_COLUMN(v_curid, i, v_date_var);
                ELSE
                DBMS_SQL.DEFINE_COLUMN(v_curid, i, v_name_var, 50);
                END IF;
            END LOOP;
            v_row_num := dbms_sql.execute(v_curid);
            -- Fetch rows with DBMS_SQL package:
            WHILE DBMS_SQL.FETCH_ROWS(v_curid) > 0 LOOP
                FOR i IN 1 .. v_colcnt LOOP
                IF (v_desctab(i).col_type = 1) THEN
                        DBMS_SQL.COLUMN_VALUE(v_curid, i, v_name_var);
                ELSIF (v_desctab(i).col_type = 2) THEN
                        DBMS_SQL.COLUMN_VALUE(v_curid, i, v_num_var);
                ELSIF (v_desctab(i).col_type = 12) THEN
                        DBMS_SQL.COLUMN_VALUE(v_curid, i, v_date_var);
                END IF;
            END LOOP;
            END LOOP;
            DBMS_SQL.CLOSE_CURSOR(v_curid);
         END;
         /
Published by: frank1018 on June 4, 2013 16:35

Published by: frank1018 on June 4, 2013 16:41

The data type is 'NO' tank (3), which is the type of data 96. See http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements001.htm#i54330
I changed 'IF (v_desctab (i).col_type = 1)' in

IF (v_desctab(i).col_type in ( 1, 96)) THEN

and it retrieves the "NOT".

I suggest one

ELSE raise_application_error(-20000, 'I dont understand data type ' || v_desctab(i).col_type || ' in ' || p_sql_stmt );

so you can see what goes wrong.

I also suggest giving an alias of column for the 'DO NOT' so it has an explicit column names. i.e.

p_sql_stmt :='select empno, ename, ''NOT'' ncol, hiredate from emp';

Published by: davidp 2 on June 4, 2013 16:38

Tags: Database

Similar Questions

  • How to get the value of a column in sql query?

    Hi, anyone knows how to get the value of a column in sql query?

    Here is my code, the value must be 1350079224397 in my PB, but I get 0

    QString query ("SELECT version FROM db_version");

    QVariant result = sda.execute (query);
    QVariantMap versionMap = result.toList () such () .toMap ();
    If (! versionMap.IsEmpty ())
    {
    qDebug()<"Version: "=""><>
    }

    OK, I have the solution

    QString query ("SELECT version as version FROM db_version");

  • Cannot get the value of the selection of OAMessageChoiceBean

    Hello

    Of our 11i to R12 upgrade, in the customer's advanced search page, we are unable to get the handle suitable for OAMessageChoiceBean (in extendedCO).

    The snippet for the bean handling is as follows:

    OAMessageChoiceBean PartyStatusFilter = (OAMessageChoiceBean) vOAPageContext.getRootWebBean () .findChildRecursive ("xxfeF426PartySearchStatus");
    String xxTest = PartyStatusFilter.getSelectionValue (vOAPageContext);

    The value of the above xxTest (in R12 approx.) is coming with a null value. Considering that the same code works in 11i environment and the xxTest output = "A".

    So we cannot get the value of the selection of the messagechoicebean in our environment of R12. I already looked in previous similar positions in this forum, also tried to use getSelectionText (vOAPageContext) or getSelectedValue(), however, it did not work.

    Pointers please?

    Thank you very much
    Zahid

    Hi Zahid,

    Try with this ID = HzPuiPartyStatus

    -Had

  • Cannot get the value of the session variable (using row wise initialization).

    Hi all

    I have a scenario where I'm trying to get the value of the variable session of two columns.

    Table of database consists of the name of USER, Country_Region, columns Country_SubRegion.

    For example: ChadraKanth, Americas, America West is the data.

    I wrote a Sql query in the block of session initialization:

    Select "CR", Country_Region, Country_SubRegion

    of row_wise_init

    where USERID = ": the USER"

    When I test the RPD code gives the result like this:

    CR WesternAmerica of Americas.

    In my report I have two columns, a region and an another subregion.

    When I try to filter with the session variable "CR" for the column region his error giving: session variable is not initialized with

    This is the default.

    Question:

    1. session variable is contains several values in the column?

    2. how to filter the report on columns of region and sub region?

    Please suggest me.

    Kind regards

    Chandra Khalil.

    Hello

    A session variable cannot store more than one column, 1 variable = 1 value (column 1), horizontal initialization allows to store several lines, multiple values in the same variable.

    If to a user, you have several lines with multiple values, you need horizontal initialization, but it cannot store in the variable the value of the region and subregion.

  • Starting from two data tables, how do you get the values in two columns using values in a column (values get col. If col. A is not null values and get the pass. B if col. A is null)?

    Two tables provided, how you retrieve the values in two columns using values in a column (the pass get values. If col. A is not null values and get the pass. B if col. A is null)?

    Guessing

    Select nvl (x.col_a, y.col_b) the_column

    from table_1 x,.

    table_2 y

    where x.pk = y.pk

    Concerning

    Etbin

  • Cannot get the value

    Hello

    I'm trying to get the value of salesmgr below xml using the query

    Select extract (' object_value, ' / abcprj:Project/@salesMgr','xmlns:abcprj="http:/sun.com/com/sun/cd/prj/1.0 ')

    ') of Project2

    However, I have some selected lines. I'm trying to get John Smith. Can someone please help me correct the request.

    <? XML version = "1.0" encoding = "UTF-8"? >

    "< abcprj:Project activeSubProject="//@subProjects.0 "startDt =" "2014-01 - 18 T 09: 56:23.491 - 0800 ' salesMgr ="John Smith""

    "' xmlns:abcprj="http:/sun.com/com/sun/cd/prj/1.0 ' xmlns:xmi = ' http://www.omg.org/XMI "xmi:version ="2.0"> "

    < subPrj = 'Test' mfg name = 'USA' >

    < / subPrj >

    < / abcprj:Project >

    Thank you

    Please close this message. content XML was bad so above query did not work.

  • Cannot get the value of the text element

    Hello

    I have a screen in the text field and I'm defining its value via javascript (using $s). If I keep the point as display text (does not save the State), I can see the value set, but get the undefined when I try to access it.
    If, on the other hand, I put it as (State record) I don't even set and get still undefined.

    Can someone please tell me how I can get its value or to register the value provided by the javascript?

    Thank you.
    Andy.

    PS You forgot to mention, I work with Apex 3.2

    Published by: Andy, 20 Sep, 2010 17:53

    This can help

    Re: Editing session with javascript State

  • Getting the value of a column based on the value of another column in a max group

    Please let me know if there is a simple way to do it.  I came up with a way, but it is terribly inefficient and it must work quickly.

    GROUP_ID NO_REGISTRE READ_VALUE QUARTERLY

    ---------- ----------- ---------- -----------------------------

    2 1 0.035 00:00:00.000000000 01/01/2015

    2 0.035

    3 1 1.11 14:50:32.943000000 14/07/2015

    3 2 222 01/01/0001 13:36:47.017436000

    3 223.11

    So what I need is for all no_registre is NULL, I need the value of QUARTERLY for the QUARTERLY to the MAX (READ_VALUE) for this GROUP_ID (not counting the rows where the no_registre is NULL).  So the result would look like this:


    GROUP_ID NO_REGISTRE READ_VALUE QUARTERLY

    ---------- ----------- ---------- -----------------------------

    2 1 0.035 00:00:00.000000000 01/01/2015

    2 0.035 00:00:00.000000000 01/01/2015

    3 1 1.11 14:50:32.943000000 14/07/2015

    3 2 222 01/01/0001 13:36:47.017436000

    3 223.11 13:36:47.017436000 01/01/01

    Someone at - it ideas?

    Or maybe:

    -production of the sample data:

    WITH t (GROUP_ID, no_registre, READ_VALUE, QUARTERLY)

    AS LONG AS)

    SELECT 2, 1, 0.035, TIMESTAMP ' 2015-1-1 00:00:00 ' FROM DUAL

    UNION ALL SELECT 2, NULL, 0.035, THE DOUBLE NULL

    UNION ALL SELECT 3, 1, 1.11, TIMESTAMP ' 2015-07-14 14:50:32 ' FROM DUAL

    UNION ALL SELECT 3, 2, 222, TIMESTAMP ' 0001-1-1-13:36:47 ' FROM DUAL

    UNION 3 SELECT ALL, NULL, 223.11, NULL FROM DUAL

    )

    --

    -actual query:

    --

    Select group_id

    no_registre

    read_value

    , last_value (quarterly) ignores NULL values over (partition by arrested by no_registre last read_value null, group_id) quarterly

    t;

  • Cannot get the value of capacity or free space with vCO vCenter plug-in 5.5.1


    Hi all

    As indicated in the title, as I migrated my devices vCO to vCO 5.5.1 (connected to 5.0 vCenters) 5.1 (connected to 5.5 Server devices vCenters) capacity and freeSpace from a given data store fields always show 0GO as value (although the provisonnedSpace displays a correct value).

    I tried to use the datastore.summary.capacity and datastore.summary.freeSpace properties, but they always return a value of 0.

    Are these properties obsolete or unusable with the 5.5.1 plugin?

    Thank you for your help.

    BZ

    Usually resolves such issues with lack of properties or values not updated, you should:

    1. take the latest technical preview of the plugin by (Version of technical overview of VMware vCenter Orchestrator plug-in for VMware vSphere 5.5.x)

    2 disable the inventory service in setting the property "com.vmware.o11n.vim.useInventoryService" to "false" (in vmo.properties).

    • Ability to disable the use of the service of inventory by setting the value of the java system property "com.vmware.o11n.vim.useInventoryService" to "false" (in vmo.properties).

    It will be useful.

  • Cannot get the value of element of disabled text.

    Hi all

    In my form. I have two or three groups of radio and the text element. When I select a radio button I am disable the text element using $x('P1_AX').disabled = true
    This part works fine. But I have a "PL/SQL block anonymous Unconditional ' which takes the value of the disabled and the update in the database.
    The value of the disabled will be void even if I have a value in it. I am able to access this value using javascript. Any help is very appreciated.

    Thank you

    Disabled items are never submitted. Therefore, you can access the item values disabled on the page dealing with the part of a page of the APEX. Your options are to

    (1) enable the item before submitting
    (2) create a hidden item coming from the same source as the element off and use the element hidden in your post submit pl/sql process

    CITY

  • Cannot get the value of the column amount in Pivot Table Preview

    Hi all
    I have the XML data and creating PivotTable to cross tab report RTF.
    I have the coulumn of the year which is dynamic. Under the present the amount displayed as zero 0 in preview. But the data are available in the XML file.

    Please let me know if something is missing.

    Thank you.

    Hi Adam,.

    The latter, a lot of scenario here, see
    http://winrichman.blogspot.com/search/label/cross%20tab

  • Cannot get the value of the property "trimChars.

    When I try to install FP I get this:

    Please let me know how to proceed.

    Thank you

    Phil

    Download the Adobe Flash Player installer directly by clicking on one of the following links.

    Flash Player ActiveX (Internet Explorer)

    Flash Player plug-in (all other browsers)

    If the direct links do not work, you will need to try another browser like Firefox to download.

  • How to get the value of the interactive report into apex 5 column

    Hello

    I want to create the master detail report with ajax.

    If I want to get the value of a specific column of interactive report when click on one line and has a value of element of selected row column value.

    Then use the elements of value to refresh the details report.

    You have a better idea to refresh the report Details according to select line of the master report without refreshing the whole page?

    Hi SYSMAN2007,

    SYSMAN2007 wrote:

    I want to create the master detail report with ajax.

    If I want to get the value of a specific column of interactive report when click on one line and has a value of element of selected row column value.

    Then use the elements of value to refresh the details report.

    You have a better idea to refresh the report Details according to select line of the master report without refreshing the whole page?

    You can do this with the help of dynamic action. You need to get the value of the column of a line click in IR (using jQuery) and set the value to the elements which, in turn, can be used as a filter to other reports on the same page.

    See: How to use the values in the columns of an interactive report (Apex 5)

    Can you reproduce your problem on apex.oracle.com and share the credentials of the workspace, so that I can demonstrate how this can be achieved.

    See an example of how it can be done with dynamic actions: https://apex.oracle.com/pls/apex/f?p=35467:5

    Kind regards

    Kiran

  • Get the value based on the column names for the custom of the Webcenter content metadata field

    University Complutense of MADRID, I created a custom text metadata field.  I then activated optlist this area.  I fill the optList values, I use a view.  The view has three columns.  Let us call their ID, Key, Value.  OptList shows keys in its list.  I then create content (Content ID: MyContent) Webcenter content and choose the OptList values for my new field of metadata (MyField).

    WebCenter portal, I'm filling a selectOneChoice with MyField values in the content ID: MyContent.  Remember the previous step, the values entered in selectOneChoice lists them selected values from the field MyField optList.  The optList is filled from view.  After the user selects a value in selectOneChoice, in Javascript, I need to alert a message in this format "selected value - matching value from the view of the optList that fills MyField.

    In my opinion, only an example will be useful:

    This is a view that I created in Configuration Manager applet in Webcenter content Admin cmdlets :

    ID | State | Capital

    1. North Carolina | Raleigh

    2. California | Sacramento

    3. Illinois | Chicago

    Then I create a custom field (name: MyField).  MyField is an optList values are filled with view created above.  Internal value and the display value are the two State.  Then I have a new content with Content Id Check-In: MyContent.  To MyContent, I select these values in OptList MyField: {North Carolina, Illinois}.

    In my portal Webcenter application, I create a Taskflow presenter content.  I have set up as single content item presenter.  I attribute as content ID MyContent.  Then, in templateView, I get all the values of MyField in MyContent and display as selectOneChoice.  I created a javascript function that would get the value that the user selected in selectOneChoice.  In the view created in the Webcenter content Configuration Manager (see above), there is a value corresponding to each displayed value.  So, for the selected value, I need to get the corresponding Capital and display in my alert message.

    Starting from Javascript, how can I get the value of the Capital, since I have the status value.

    Hello.

    The idea to reach your requirement is planned:

    • Create an Assistant manage bean that will appeal as access map: #{stateUtil ['Calofironia']} (it will return Raleigh). This value will get calling GET_SCHEMA_VIEW_VALUES IDC service using RIDC in your managed bean.
    • Pass the result of #{stateUtil ["statename"]} to your JavaScript function to help

    I hope this information help you.

    Kind regards

  • Need help with Javascript to get the value of standard report column

    Hi all

    Apex 3.1 version

    I have a query SQL (editable report) region where I need to do validations using a process of OnDemand and javascript. For this posting, I need to use the serial number and id of this same report line item. The function is called when the serial number is changed. I can get the serial number easily because it is a text field, however, the item id is a standard report column (which actually a text field or hidden gives me a checksum error, long story). How can I get the value of the standard report column to set the value of an element of the Application to use in my process of application as well as the serial number? Here is my code below.
    <script>
    
    function f_ValidateSerial(pThis)
    {
        
      // The row in the table
    
      var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    
        //alert('Row is '+vRow);
    
    
      // Display the serial number
        //alert('The Serial Number is '+html_GetElement('f21_'+vRow).value);
    
      
     var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateSerial',0);
     get.add('F101_SERIAL_NUMBER',html_GetElement('f21_'+vRow).value);
     get.add('F101_INVENTORY_ITEM_ID',+html_GetElement(?????+vRow).value);   // Here's where I need to get the item id to set application item!!
     
     gReturn = get.get();
     
    if (gReturn)
        { 
          alert(gReturn);
        }
     
      if(gReturn)
        { 
          html_GetElement('f21_'+vRow).value = '';
        }
               
    }
    </script>

    Hello

    Ok

    Item ID is standard report column.
    If you enter this Expression HTML column

    #ITEM_ID#
    

    I guess that the substitution of column item Id is #ITEM_ID #.

    Now, you have hidden input form that is not submitted.
    Then in JavaScript

    get.add('F101_INVENTORY_ITEM_ID',+html_GetElement('item_id_'+Number(vRow)).value);
    

    Kind regards
    Jari

Maybe you are looking for

  • Why Firefox doesn't open Foxit Reader in its own window?

    When you navigate with Frefox, I used to be able to click on a PDF link and Foxit Reader to open the file in a separate window (Foxit). Now no matter what I do, the PDF opens in Firefox in what I assume is a reader of PDF in Firefox. How canI do this

  • Mac e-mail issues

    I use Mac book pro, today I support by mistake on REBUILD button in my mail box and all of a sudden my Inbox emails are missing, well want to help me to recharge my Inbox emails.

  • Is it possible to get a list of the refnums all ActiveX objects loaded into memory?

    Specifically, I want to programmtically save and close an open excel workbook which has not yet been registered and I don't know the name of. LabVIEW. I know how to manipulate the workbooks I open from a saved location, but don't know how to take any

  • Telephone fax line

    AT & T provides services to my home/office I have an individual line business with 2 numbers, one for voice and one for fax. The two lines are differentiated by separate and distinct rigns. The fax is unable to make the difference between the two cau

  • Microsoft Works processor trying to open my Word documents, even if I have Word 97 student edition help!

    Microsoft Works processor trying to open my Word documents, even if I have Word 97 student edition help! How can I make Word 97 as the default and get rid of Microsoft Works Word?