Save a dynamic sql into a column

Hello,
I need to save dynamic SQL into a column called STR in a table.
I have a insert into table A( id, fname, lname)
values(1, 'John', 'Smith');
I have a requirement to save the DML statement that user executed such as this insert statement into table 'A'.
I have to save this into anoter table called 'B' in the 'STR' column.
I have to save that whole insert statement into a cloumn 'STR' in table 'B'
How can do this?
Thank you..

This is not for auditing. The shop wants to save the DML statements in a table when a user does updates and inserts.. at the same time they want to build dynamic sql for this as a string such as update emp set where empno = 1 etc....
could you give me an example please.
Thanks a bunch....

Similar Messages

  • Dynamic SQL in Formula Column in OracleReports6i

    Following code is in formula column of my report. passing dynamic sql str1(actullay, this string comes from after parameter trigger form) into SQL and executing thru DBMS_SQL.PARSE function. it's failed with 'Fatal PL/SQL error occured' ...
    Coupld any one help me on this...
    function CF_1FORMULA0006 return Number is
    Credits1 NUMBER(10,2);
    str1 VARCHAR2(50) := 'AND b.PROGRAMID = 2 ';
    c1 INTEGER := dbms_sql.open_cursor;
    c2 INTEGER;
    begin
    begin
    dbms_sql.parse(c1,
    'SELECT NVL(SUM(a.AMOUNT),0) INTO Credits1' | |
    'FROM SPONSOR_TRAN_DATA a, SPONSOR b ' | |
    ' WHERE ' | |
    ' a.TRANTYPE = 41 ' | |
    ' AND a.SPONSORID = b.SPONSORID ' | |
    str1 | |
    'AND a.amount > 0 ' | |
    'AND a.timestamp >= :reportdate ' | |
    'AND a.timestamp < :reportdate + 1' ,2);
    c2 := dbms_sql.execute(c1);
    exception
    when no_data_found then
    Credits1 := 0;
    end;
    return Credits1;
    end;
    Thanks in advance......

    It looks like forms are not supporting text functions like FR yet, I gave it a try <<MemberName("<Formname>","<POV DIM Name>)>> in the formula header area and it didn't like it. It is just displaying what ever I typed in there.

  • Put results of dynamic sql into pl/sql table

    Hi.
    I tried to "google up" solution to my problem but in vain, so if possible could you give me a hint?
    The test code which I will paste here is somewhat akward, it is part of bigger code and I tried to simplify and adjust it.
    The problem is:
    I have sql statement which I construct on the run, and I want to put results of this statement into collection.
    With present code I get "ORA-00932: inconsistent datatypes".
    The collection must be global, since later on I need to do selects from this collection using:
    select col_1, col_2, col_3 from table(cast(v_pole_final as t_pole)))
    And I do not want put constructors into sql statements (which i believe would help).
    The select will always return columns types varchar, number, number.
    I.e. the same structure as in type "t_zaznam".
    I want to use "execute immediate", or "ref cursor - fetch bulk collect into collection".
    Thanks for help.
    Jan
    -------------- My code:
    create or replace type t_zaznam is object (col_1 varchar2(64), col_2 number, col_3 number);
    create or replace type t_pole is table of t_zaznam;
    create or replace function sulc_experim return number
    is
    s_sql_temp varchar2(6000):= 'select ''asdf asdf'', 7, 777 from dual '||
    ' union '||
    ' select ''yes boss'', 1, 111 from dual'||
    ' union '||
    ' select ''go home'', 9, 999 from dual';
    v_pole t_pole:= t_pole();
    v_pole_final t_pole:= t_pole();
    begin
    execute immediate s_sql_temp into v_pole;
    return 0;
    end sulc_experim;

    user5714007 wrote:
    Thank you.
    I think this is what I meant by "And I do not want put constructors into sql statements (which i believe would help)."
    It would be helpful to be able to select "on the fly" also multiple-columns and mainly multiple-rows results into collection.In case you didn't notice: The deciding difference that Karthik made was this line:
    execute immediate s_sql_temp bulk collect into v_pole;
    If that is not the trouble you have, then please explain you problem with a few samples. What works and what does not work.
    Also there is always dbms_sql where you can create the paramters/output types "on the fly".

  • Dynamic SQL rows to column

    I have a table something like
                                  WHERE    IN
                                  Age           18
                                  Year           2012,2013
                                  Color         Blue
    --etc
                                  I would like to create a dynamic statement base on this table
                                  Dyanmic SQL:
                                  WHERE AGE IN (18) and Year IN (2012,2013) and Color IN (‘Blue’)
    I am using SQL server 2008 R2. How can I do this using XML path or something

    Here you go:
    DECLARE @tbl TABLE ([WHERE]   sysname NOT NULL,
                         [IN]     nvarchar(200))
    INSERT @tbl([WHERE], [IN])
       VALUES ('Age', '18'), ('Year', '2012,2013'), ('Colour', 'Blue,Yellow')
    DECLARE @where nvarchar(MAX)
    SELECT @where =
       (SELECT [WHERE] + ' IN (' +
                CASE WHEN [IN] LIKE '%[^0-9,]%'
                     THEN replace(quotename([IN], ''''), ',', ''',''')
                     ELSE [IN]
                END + ') AND '
        FROM   @tbl
        FOR XML PATH(''), TYPE).value('.', 'nvarchar(MAX)') + ' 1 = 1'
    SELECT @where
    However, this is somewhat brittle. I'm assuming that a comma is a list separator; never part of a value searched for. I'm also assume that as long as a value is digits only, it is numeric, else it is a string. This would fail if there is a date value
    on the form YYYYMMDD.
    Probably you should store metadata somwhere, so that you know the data type of a column.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Save a huge data into oracle column

    How can i save an expression like (a & b) | C | D | (e & f) in oracle. And how how can i retrieve that in java.
    a ,b c,d are some values.

    This is my requirement .UI side
    Som crtiterias here                                                           result
    A1
    (ERN & TVR ) | (CLT) | (ADS & MDF)
    A2
    B|C
    here ( ,& | are free test .The ERN and TVR are value from value chooser.So its a VO.If I select A1 from left side corresponding result can fetch from rt side.
    I want to save this information in oracle db and will display in java.How its possible
    You just displayed it in the forum. Do it the same way in Java. Only YOU can decide how you want your app to display the data. You can store it as one line or multiple lines depending on your needs and how you construct it to begin with.
    The expression can be stored in a VARCHAR2 that holds up to 4000 bytes. If you need more space you can define the table column as a CLOB and store the expression there.
    You said those items (e,g. ERN, TVR, CLT, ADS, etc) are selected from a 'value chooser' but it so then they would have to be BOOLEAN (true/false) values. Either that or your 'expression' is not really meant to be executed as part of a query.
    So you can display results like this example if you wanted:
    Attributes
    age
      none - 174531
      pre_teen - 174402
      teen - 174641
      young - 174752
      middle_aged - 175115
      old - 175144
    marital_status
      none - 261875
      single - 262808
      married - 261962
      divorced - 261931
    young & divorced
    young - 174742 -----
                        - & - 43798
    divorced - 261931 --
    -- more complex
    (CA | CO) & (young & divorced) & ((baseball & pepsi) | (golf & coors))
    ca - 18951
               -- | 37810
    co - 18859
                                  -- & - 1636
    young - 174742
                      - & - 43798
    divorced - 261931
                                               -- & - 112
    baseball - 174564
                      - & - 29363
    pepsi - 174788
                                  -- | 64040
    golf - 17444
                   - & - 34677
    coors - 209604
    Assuming the attributes themselves are stored in table columns also see my reply in this thread for an example of how bitmap indexes can be used for querying data like that
    https://forums.oracle.com/forums/thread.jspa?messageID=10217613&#10217613
    select rowid from star_fact where
    (state = 'CA') or (state = 'CO')
    and (age = 'young') and (marital_status = 'divorced')
    and (((summer_sport = 'baseball') and (softdrink = 'pepsi'))
    or ((summer_sport = 'golf') and (beer = 'coors'

  • How to use the column names generated from Dynamic SQL

    Hi,
    I have a problem with Dynamic SQL.
    I have written an SQL which will dynamically generate the Select statement with from and where clause in it.
    But that select statement when executed will get me hundreds of rows and i want to insert each row separately into one more table.
    For that i have used a ref cursor to open and insert the table.
    In the select list the column names will also be as follows: COLUMN1, COLUMN2, COLUMN3,....COLUMNn
    Please find below the sample code:
    TYPE ref_csr IS REF CURSOR;
    insert_csr ref_csr;
    v_select VARCHAR2 (4000) := NULL;
    v_table VARCHAR2 (4000) := NULL;
    v_where VARCHAR2 (4000) := NULL;
    v_ins_tab VARCHAR2 (4000) := NULL;
    v_insert VARCHAR2 (4000) := NULL;
    v_ins_query VARCHAR2 (4000) := NULL;
    OPEN insert_csr FOR CASE
    WHEN v_where IS NOT NULL
    THEN 'SELECT '
    || v_select
    || ' FROM '
    || v_table
    || v_where
    || ';'
    ELSE 'SELECT ' || v_select || ' FROM ' || v_table || ';'
    END;
    LOOP
    v_ins_query :=
    'INSERT INTO '
    || v_ins_tab
    || '('
    || v_insert
    || ') VALUES ('
    || How to fetch the column names here
    || ');';
    EXECUTE IMMEDIATE v_ins_query;
    END LOOP;
    Please help me out with the above problem.
    Edited by: kumar0828 on Feb 7, 2013 10:40 PM
    Edited by: kumar0828 on Feb 7, 2013 10:42 PM

    >
    I Built the statement as required but i need the column list because the first column value of each row should be inserted into one more table.
    So i was asking how to fetch the column list in a ref cursor so that value can be inserted in one more table.
    >
    Then add a RETURNING INTO clause to the query to have Oracle return the first column values into a collection.
    See the PL/SQL Language doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/returninginto_clause.htm#sthref2307

  • Dynamic SQL Query to Find Special Characters in Table columns

    Hi,
    I am new to OTN FORUMS.
    I am trying to find the columnsi of a table which have special characters in them.
    I am planning on using this query
    select ' select INSTR('||column_name||', chr(0))
    from '||table_name||'where INSTR('||column_name||', chr(0)) >0' from user_tab_columns
    where table_name='Account'
    and spool the output to run as a script.
    Is this the right way or do u suggest any modifications to the query?
    Thanks in advance.

    Hi,
    I think your basic approach is right. Since you can't hard-code the table- or column names into the query, you'll need dynamic SQL.
    Instead SQL-from-SQL (that is, writing a pure SQL query, whose output is SQL code), you could do the whole job in PL/SQL, but I don't see any huge advantage either way.
    When you say "Special character<b>s</b>", do you really mean "one given special character" (in this case, CHR(0))?
    Will you ever want to search for multiple special characters at once?
    What if table foo has a column bar, and in 1000 rows of foo, bar contains CHR (0). Do you want 1000 rows of output, each showing the exact position of the first CHR(0)? If the purpose is to look at theese rows later, shouldn't you include the primary key in the output? What if CHR(0) occurs 2 or more times in the same string?
    If you'd rather have one row of output, that simply says that the column foo.bar sometimes contains a CHR(0), then you could do something like this:
    SELECT     'foo',     'bar'
    FROM     dual
    WHERE     EXISTS (
                SELECT  NULL
                FROM       foo
                WHERE       INSTR ( bar
                            , CHR (0)
                        ) > 0
                );

  • SQL from Table Column with Dynamic URL Problem

    This is the SQL I'm attempting to save to a table column via the Object Browser;
    select
    "a"."PBR_BRIEF_ID" "Brief ID",
    "a"."PROJECT_NUMBER" "Project",
    "b"."DESCRIPTION" "Description",
    "b"."ACTUAL_END_DATE" "Actual End",
    "b"."RFS_DATE" "RFS",
    "b"."LOCATION_CODE" "Location",
    ''||"b"."ESA_CODE"||'' "ESA",
    "b"."PROJECT_USER_STATUS" "Status",
    "b"."PROJECT_TRIGGER" "Trigger"
    from
    UPT1TRIAL.FUND_PLAN_BRIEF_LINK_CCR@NDSD "a",
    UPT1INTEGRAL.INT_PROJECT_DATA@NDSD "b"
    where
    "a"."PBR_BRIEF_ID" = :P3_BRIEF_ID and
    "a"."PROJECT_NUMBER" = "b"."PROJECT_DEFINITION_NUMBER"
    The intesting bit is the following, where a URL is return behind a particular column;
    ''||"b"."ESA_CODE"||'' "ESA",
    It's interesting because when I click on "Apply Changes" in the Object Browser, the text that appears in the column is as follows, i.e. with APP_ID and SESSION populated;
    ''||"b"."ESA_CODE"||'' "ESA",
    Why would that happen??
    The full SQL above is used in an application page with a SQL Query (PL/SQL function body returning SQL query). The basic SQL works OK but because of what the Object Browser is doing, the link does not.
    Message was edited by:
    Damian - apologies for lack of formatting!!
    Message was edited by:
    Damian

    Damian,
    Use
    & lt;
    for your &lt; tags and then the message will appear in the proper format.
    If you are using dynamic sql to generate an url with APP_ID and SESSSION you could:
    a) create page items (P1_APP_ID and P1_SESSION)
    b) compute those page items to the actual APP_ID and SESSION_ID
    c) use the value of those items while generating your dynamic sql (instead of APP_ID and SESSION)
    Then, your links will show the right APP_ID and the right SESSION.
    Denes Kubicek

  • Convert a trigger format into a  stored procedure using Dynamic Sql

    Hi everyone,
    ihave table
    Table_NAME_ABCD contains
    i have a trigger Table_NAME_ID,ROW_CREATED_DATE,ROW_CREATED_BY,ROW_CHANGED_DATE,ROW_CHANGED_BY,UNQ columns
    i am populating Table_NAME_ID(primary_key) using sequencer in the below mentioned trigger.
    and for this table i have created IU trigger for inserting or updating trigger will fire
    create or replace
    TRIGGER "Table_NAME_IU_TRG" BEFORE INSERT OR UPDATE ON Table_NAME_ABCD FOR EACH ROW
    BEGIN
    If inserting then
    If :new.Table_NAME_ID is NULL THEN
    SELECT Table_NAME_ID_ABCD_SEQ.NEXTVAL INTO :NEW.Table_NAME_ID FROM DUAL;
    end if;
    if :new.ROW_CREATED_DATE is NULL then
    :new.ROW_CREATED_DATE := SYSDATE;
    end if;
    if :new.ROW_CREATED_BY is NULL then
    :new.ROW_CREATED_BY := USER;
    end if;
    if :new.ROW_CHANGED_DATE is NULL then
    :new.ROW_CHANGED_DATE := SYSDATE;
    end if;
    if :new.ROW_CHANGED_BY is NULL then
    :new.ROW_CHANGED_BY := USER;
    end if;
    if :new.UNQ is NULL then
    :new.UNQ := SYS_GUID():
    end if;
    end if;
    If updating then
    :new.ROW_CHANGED_DATE := SYSDATE;
    :new.ROW_CHANGED_BY := USER;
    end if;
    END;
    above mentioned table along with trigger is same format for ~100 different tables i have been created.
    i want a stored procedure in side it above mentioned trigger (i.e., for inserting or updating )code should be written with Dynamic Sql so that when ever i am passing Tablename as a parameter it should work.
    please suggest me.

    What is new since this thread?
    Stored procedure instead of Trigger

  • Column names dynamically in Dynamic SQL

    Hi All,
    We can use Table Name dynamically in Dynamic SQL.
    Can we use column names dynamically?
    Thanks,
    Umasankar

    Hi Todd Barry,
    Thanks lot for your immediate response.
    Could you please tell me, how can we use column name dynamically?
    I tried but, I didnt get the correct result.
    Here is my coding.
    Declare
    SQL_String Varchar2(2000);
    Category varchar2(50):= 'ELECTRO_PLATING_413';
    Type ConstCurTyp is REF CURSOR;
    Const_Cv ConstCurTyp;
    vLab_name varchar2(80);
    Begin
    Execute Immediate 'Truncate table tto_lab_names';
    dbms_output.put_line(category);
    dbms_output.put_line(' ');
    SQL_String := 'Select lab_name from tto_constituents where :category is not null';
    Open Const_cv for SQL_String using category;
    Loop
    Fetch Const_Cv into vLab_Name;
    Exit When Const_Cv%NotFound;
    Insert into lab_names values(vLab_name);
    End Loop;
    Commit;
    Close Const_Cv;
    End;
    I am getting all the lab_names as result.
    Thanks,
    Umasankar
    null

  • Dynamic SQL Pivoting(Converting Row to Columns)

    Hi All,
    I am using Oracle 9i (Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production)
    and also 10g version
    I am facing difficulties to find out the logic for
    converting the set of values in one of the columns into the column headings for the entire query.
    create TABLE my_tab ( deptno VARCHAR2(5), job VARCHAR2(50), sal NUMBER);
    insert into my_tab ( deptno,JOB, sal) values ( 10, 'ANALYST', 23000);
    insert into my_tab ( deptno,JOB, sal) values ( 10, 'SALESMAN', 1500);
    insert into my_tab ( deptno,JOB, sal) values ( 10, 'CLERK', 3550);
    insert into my_tab ( deptno,JOB, sal) values ( 20, 'SALESMAN', 700);
    insert into my_tab ( deptno,JOB, sal) values ( 20, 'ANALYST', 4200);
    insert into my_tab ( deptno,JOB, sal) values ( 30, 'SALESMAN', 5600);
    insert into my_tab ( deptno,JOB, sal) values ( 30, 'CLERK', 12000);
    insert into my_tab ( deptno,JOB, sal) values ( 30, 'ANALYST', 19000);
    COMMIT;
    SELECT * FROM my_tab
    DEPTNO ______ JOB ________ SAL
    10 ______ ANALYST ________ 23000
    10 ______ SALESMAN     ________     1500
    10     _______ CLERK     ________     3550
    20     _______     SALESMAN ________     700
    20     _______     ANALYST     ________ 4200
    30     _______     SALESMAN ________     5600
    30     _______     CLERK     _______          12000
    30     _______ ANALYST     _______     19000
    --And I wish to convert it into this structure:
    DEPTNO ________ ANALYST ________ SALESMAN _________ CLERK
    10      ________     23000 ________     1500     _________     3550
    20     ________ 4200 ________     700     _________     NULL
    30     ________ 19000 ________     5600     _________     12000
    It may be dynamic. i.e Later i inserted more two records into My_tab.
    insert into my_tab ( deptno,JOB, sal) values ( 20, 'CLERK', 3400);
    insert into my_tab ( deptno,JOB, sal) values ( 30, 'MANAGER', 48000);
    So it should be dynamic.
    output is like this.
    DEPTNO ________ ANALYST ______ SALESMAN ______ CLERK ______ MANAMGER
    10           ________ 23000     ______ 1500     ______ 3550     ______     NULL
    20          ________ 4200     ______ 700     ______ 3400     ______     NULL
    30          ________ 19000     ______ 5600     ______ 12000     ______     48000
    Please help me regarding this.
    With warm regards,
    Prasanta

    Hi, Prasanta,
    Displaying one column from many rows as many columns on one row is called Pivoting . The following thread shows the basics of how to pivot:
    Help for a query to add columns
    That example uses the aggregate COUNT function; you'll want SUM (or possibly MIN or MAX) instead.
    Getting a dynamic number of columns requires Dynamic SQL . As a simpler alternative to pivoting and dynamic SQL, you might consider String Aggregation , where you concatenate a column from many rows into one big string, to be displayed on one row.
    See the following thread for more about string aggregation and other options on pivoting into a variable number of columns:
    Re: Report count and sum from many rows into many columns

  • How to rename C00n generic column names in a Dynamic SQL report

    I have a an interface whereby the user can select 1 to 60 (upper limit) columns out of 90 possible columns (using a shuttle) from one table before running a report.
    To construct the SQL that will eventually execute, I'm using a "PLSQL function body returning SQL query" with dynamic SQL. The only problem is that I have to use "Generic Column Names" option to be able to compile the code and end up with c001 to c060 as the column names.
    How can I use the names of the selected columns as the report headings rather than c001, C002... etc?
    I do not know beforehand which columns, or how many columns or the order of the selected columns.
    I know Denes K has a demo called Pick Columns but I can't access his code. I have a hunch though that he may be just using conditions to hide/show the apropriate columns.
    thanks in advance
    PaulP

    Hi Paul
    I would change the Heading Type in the Report Details screen to PLSQL and use the shuttle item to return the column values. e.g.
    RETURN :p1_shuttle;
    I'm assuming the shuttle already has a colon separated list of the column headings in the correct order?
    I hope that helps
    Shunt

  • Insert into using a select and dynamic sql

    Hi,
    I've got hopefully easy question. I have a procedure that updates 3 tables with 3 different update statements. The procedure goes through and updates through ranges I pass in. I am hoping to create another table which will pass in those updates as an insert statement and append the data on to the existing data.
    I am thinking of using dynamic sql, but I am sure there is an easy way to do it using PL/SQL as well. I have pasted the procedure below, and what I'm thinking would be a good way to do it. Below I have pasted my procedure and the bottom is the insert statement I want to use. I am faily sure I can do it using dynamic SQL, but I am not familiar with the syntax.
    CREATE OR REPLACE PROCEDURE ACTIVATE_PHONE_CARDS (min_login in VARCHAR2, max_login in VARCHAR2, vperc in VARCHAR2) IS
    BEGIN
    UPDATE service_t SET status = 10100
    WHERE poid_id0 in
    (SELECT poid_id0 FROM service_t
    WHERE poid_type='/service/telephony'
    AND login >= min_login AND login <= max_login);
    DBMS_OUTPUT.put_line( 'Service Status:' || sql%rowcount);
    UPDATE account_t SET status = 10100
    WHERE poid_id0 IN
    (SELECT account_obj_id0 FROM service_t
    WHERE poid_type = '/service/telephony'
    AND login >= min_login AND login <= max_login);
    DBMS_OUTPUT.put_line( 'Account Status:' || sql%rowcount);
    UPDATE account_nameinfo_t SET title=Initcap(vperc)
    WHERE obj_id0 IN
    (SELECT account_obj_id0 FROM service_t
    WHERE poid_type='/service/telephony'
    AND login >=min_login AND login <= max_login);
    DBMS_OUTPUT.put_line('Job Title:' || sql%rowcount);
    INSERT INTO phone_card_activation values which = 'select a.status, s.status, s.login, to_char(d.sysdate,DD-MON-YYYY), ani.title
    from account_t a, service_t s, account_nameinfo_t ani, dual d
    where service_t.login between service_t.min_login and service_t.max_login
    and ani.for_key=a.pri_key
    and s.for_key=a.pri_key;'
    END;
    Thanks for any advice, and have a good weekend.
    Geordie

    Correct my if I am wrong but aren't these equal?
    UPDATE service_t SET status = 10100
    WHERE poid_id0 in
    (SELECT poid_id0 FROM service_t
    WHERE poid_type='/service/telephony'
    AND login >= min_login AND login <= max_login);
    (update all the records where there id is in the sub-query that meet the WHERE Clause)
    AND
    UPDATE service_t SET status = 10100
    WHERE poid_type='/service/telephony'
    AND login >= min_login AND login <= max_login);
    (update all the records that meet the WHERE Clause)
    This should equate to the same record set, in which case the second update would be quicker without the sub-query.

  • When I save a PDF as an Excel File, all of the data in the PDF is put into one column (AdobeXI)

    Hi, thanks for taking the time...
    I'm running a machine with Windows 7, Office 2010, and Acrobat XI.  When I save a specific PDF as an Excel workbook, all of the data in the original PDF is sorted correctly in four columns.  When the same task is performed on this file on another user's machine, all of the data is sorted into one column.  The user has the same versions of Windows, Office, and Acrobat.  I've attempted the "Repair installation" option but the problem persists.  Any suggestions?  Thanks again for helping,
    -E

    Thanks for the quick reply.  I figured out how to get the desired results by using tagging.  For anyone who may reference this post in the future, I went to "Customize" in the top right corner of Adobe, then selected "Create new tool set...", looked under "accessiblity and found the "tag" option.  Hit ok, tag is added to the toolbar.  Then I highlighted the dataset in the PDF that was relevant to the output format, then clicked "tag", saved as spreadsheet.  Sorry I can't provide more details on how tagging works or if there's a more elegant solution available, but I'm sure one's out there.

  • How to determine column length semantics through ANSI Dynamic SQL ?

    I am looking for a way to determine the length semantics used for a column through ANSI Dynamic SQL.
    I have a database with NLS_CHARACTERSET=AL32UTF8.
    In this database I have the following table:
    T1(C1 varchar2(10 char), C2 varchar2(40 byte))
    When I describe this table in SQL*Plus, I get:
    C1 VARCHAR2(10 CHAR)
    C2 VARCHAR2(40)
    In my Pro*C program (mode=ansi), I get the select statement on input, use PREPARE method to prepare it and then use the GET DESCRIPTOR method to obtain colum information for output:
    GET DESCRIPTOR 'output_descriptor' VALUE :col_num
    :name = NAME, :type = TYPE,
    :length = LENGTH, :octet_length = OCTET_LENGTH
    For both C1 and C2 I get the following:
    :type=12
    :length=40
    :octet_length=40
    So, even if I know that my database is AL32UTF8, there doesn't seem to be a way for me to determine whether char or byte length semantics were used in C1 and C2 column definitions.
    Does anybody know how I can obtain this information through ANSI Dynamic SQL?
    Note: the use of system views such as ALL_TAB_COLUMNS is not an option, since we wish to obtain this information even for columns in a complex select statements which may involve multiple tables.
    Note: I believe OCI provides the information that we need through OCI_ATTR_DATA_SIZE (which is in bytes) and OCI_ATTR_CHAR_SIZE (which is in chars). However, switching to OCI is something we would like to avoid at this point.

    Yes, I was wondering which forum would be the best for my question. I see similar questions in various forums, Call Interface, SQL and PL/SQL and Database - General. Unfortunately there is no Pro*C or Dynamic SQL forum which would be my first choice for posting this question.
    Anyway I now posted the same question (same subject) in the Call Interface forum, so hopefully I'll get some answers there.
    Thank you for the suggestion.

Maybe you are looking for

  • Exchange rate according to document date

    Hello all, We are creating PO and then Goods receipt. I need to change exchange rate according to document date while creating Goods Reiceipt. We have done few customizing changes for this. Translation date has been updated with the document date but

  • How to remove switchboard from mac os maverics

    how do you remove switchboard form mac os maverics.  process monitor reports not responding.  process is started when cs6 bridge is excited.

  • WCS 6.0 Reporting

    Does anyone know what the definition is of a "Number of Unique User"  in the Client Summary report would be as opposed to the "Number of Users" ?

  • Physical DataGuard issue

    Hello, - Primary Database and Standby versions: 11.2.0.3. Linux Redhat 5. - Physical Standby database created using rman active duplication command. - Archive logs are shipping and applied to standby. I am trying to setup the broker to manage the DG

  • Scrubby Zoom and hand tool stop working out of the blue?

    I checked my preferences and OpenGL is enabled, so I don't understand why it randomly stops working when I'm trying to get work done. Been working for less than four hours today and have had to restart Photoshop CS5.5 6 times. It starts working for a