Convert normalized query to procedure to function

Hi,
I have a table with this structure:
CREATE TABLE TRANS
  ITEM_ID    VARCHAR2(8 BYTE),
  ITEM_TYPE  VARCHAR2(20 BYTE),
  ITEM_YEAR  NUMBER,
  JAN        FLOAT(126),
  FEB        FLOAT(126),
  MAR        FLOAT(126),
  APR        FLOAT(126),
  MAY        FLOAT(126),
  JUN        FLOAT(126),
  JUL        FLOAT(126),
  AUG        FLOAT(126),
  SEP        FLOAT(126),
  OCT        FLOAT(126),
  NOV        FLOAT(126),
  DEC        FLOAT(126)
)I wrote the following PL/SQL to normalize the data into a few columns. Now I need help converting this to a package procedure, and this is where I am stuck.
DECLARE
   TYPE c IS REF CURSOR;
   cur    c;
   TYPE r IS RECORD (
      itm   trans.item_id%TYPE,
      mth   VARCHAR2 (3),
      val   FLOAT
   rec    r;
   stmt   VARCHAR2 (200);
   item   VARCHAR (8)    := 'AB054240';
BEGIN
   FOR i IN 1 .. 12
   LOOP
-- calls function to return abbreviated month name
      stmt :=
            'SELECT item_id,  get_month_abbrev ('
         || i
         || '), '
         || get_month_abbrev (i)
         || ' FROM trans t WHERE t.item_id = '''
         || item
         || '''';
      OPEN cur FOR stmt;
      LOOP
         FETCH cur
          INTO rec;
         EXIT WHEN cur%NOTFOUND;
-- test
         DBMS_OUTPUT.put_line ( rec.itm || chr(9) || rec.mth || chr(9) || rec.val);
      END LOOP;
   END LOOP;
   CLOSE cur;
END;In searching online, I got the idea of creating an Object Type for the 'record' type and a Collection Type for the table based on the former.
I would then open the table using a sys_refcursorUnfortunately, I could not get this to work. Ideally I would like to keep it all encapsulated in one procedure. I can't figure out a way to make an OUT parameter that will hold the table.
The end result is that I have a client program that will execute this procedure/function to return the normalized query result set for display.
Any suggestion or critique would be appreciated.

I still don't understand why you feel the need for looping round to create your dynamic SQL when you could just use static SQL (eg, like the query I gave you earlier)?
If you're wanting to take a row and turn it on its side, then the query I provided would do what you wanted:
with trans as (select 1 item_id, 'A' item_type, 2009 item_year, 10 jan, 20 feb, 30 mar, 40 apr, 50 may, 60 jun, 70 jul, 80 aug, 90 sep, 100 oct, 110 nov, 120 dec from dual union all
               select 1 item_id, 'A' item_type, 2008 item_year, 110 jan, 120 feb, 130 mar, 140 apr, 150 may, 160 jun, 170 jul, 180 aug, 190 sep, 1100 oct, 1110 nov, 1120 dec from dual union all
               select 2 item_id, 'C' item_type, 2009 item_year, 210 jan, 220 feb, 230 mar, 240 apr, 250 may, 260 jun, 270 jul, 280 aug, 290 sep, 2100 oct, 2100 nov, 2120 dec from dual),
-- end of mimicking data in your table
month_tab as (select 'JAN' month_name from dual union all
               select 'FEB' month_name from dual union all
               select 'MAR' month_name from dual union all
               select 'APR' month_name from dual union all
               select 'MAY' month_name from dual union all
               select 'JUN' month_name from dual union all
               select 'JUL' month_name from dual union all
               select 'AUG' month_name from dual union all
               select 'SEP' month_name from dual union all
               select 'OCT' month_name from dual union all
               select 'NOV' month_name from dual union all
               select 'DEC' month_name from dual)
SELECT tr.item_id "Item",
       mt.month_name "Month",
       DECODE(mt.month_name, 'JAN', tr.jan,
                             'FEB', tr.feb,
                             'MAR', tr.mar,
                             'APR', tr.apr,
                             'MAY', tr.may,
                             'JUN', tr.jun,
                             'JUL', tr.jul,
                             'AUG', tr.aug,
                             'SEP', tr.sep,
                             'OCT', tr.oct,
                             'NOV', tr.nov,
                             'DEC', tr.dec) "Amount"
FROM   trans tr,
       month_tab mt
WHERE  tr.item_id = 1 --p_item_id
AND    tr.item_year = 2009 --p_item_year;
      Item Month     Amount
         1 JAN           10
         1 FEB           20
         1 MAR           30
         1 APR           40
         1 MAY           50
         1 JUN           60
         1 JUL           70
         1 AUG           80
         1 SEP           90
         1 OCT          100
         1 NOV          110
         1 DEC          120There are several advantages for using one static query:
1. Easier to debug: the query is right there - you can copy it out of the procedure, change the parameters and then run it to see what values were being returned. You do not have to manually construct the query prior to running it.
2. Less code, less steps - therefore increased performance and easier maintenance. You no longer have an extra function call that the database needs to execute every time it runs the query.
3. More efficient code; no need to access the table 12 times, as the above query only accesses the table once. Again, leading to improved performance.
4. Easier to read and there maintain.
5. The PL/SQL engine won't check dynamic sql until runtime; if you've made a syntax error, the code will still compile, but will fail at runtime. With static SQL, the code won't compile until you've fixed all syntax errors.
6. Dynamic sql won't show up in the dependencies views (eg. user_dependencies), so makes it harder to track what tables are used by your code.
In short, avoid dynamic SQL if you can, stick to doing as much of the work in SQL as you can and hopefully you'll have faster and easier-to-maintain code.

Similar Messages

  • Need (procedure or function or sql query )for Email filter

    Hi All,
    in (procedure or function or sql query ) ,if i pass the a input parameter like (anbu@y or anbu@ or anbu@yahjjj ) ,i need to get output like [email protected] .
    please give me code for this ...

    SQL> with t
      2  as
      3  (
      4  select 'anbu@y' email from dual union all
      5  select 'anbu@' from dual union all
      6  select 'anbu@yahjjj' from dual
      7  )
      8  select email, regexp_replace(email, '@.*','@yahoo.com') email_new
      9    from t
    10  /
    EMAIL
    EMAIL_NEW
    anbu@y
    [email protected]
    anbu@
    [email protected]
    anbu@yahjjj
    [email protected]

  • Query for getting all function and procedure inside the packages

    hi All
    Please provide me Query for getting all function and procedure inside the packages
    thanks

    As Todd said, you can use user_arguments data dictionary or you can join user_objects and user_procedures like below to get the name of the packaged function and procedure names.
    If you are looking for the packaged procedures and functions source then use user_source data dictionary
    select a.object_name,a.procedure_name from user_procedures a,
                  user_objects b
    where a.object_name is not null
    and a.procedure_name is not null
    and b.object_type='PACKAGE'        
    and a.object_name=b.object_name

  • 2.....how to convert normal function module into remote enabled function mo

    Hi...
    2.....how to convert normal function module into remote enabled function module?
    thanks and regards,
    k.swaminath.

    Hi,
    In the attributes tab select radio button as  remote enabled instead of normal..
    u can call the remote enabled fm as...
    CALL FUNCTION <Function module> destination <destination name>
    Regards,
    Nagaraj

  • How to convert SQVI to a normal query in SQ01 under client-specific query

    Dear all,
    I would like to know how to perform the following. Can you show me step by step as I don't know how to use SQ01 nor SQVI.
    Convert SQVI to a normal query in SQ01 under client-specific query area
    Thanks
    tuffy
    Thien is right. Invest some time into researching the above mentioned topics before turning to the forums for help.
    Edited by: kishan P on Aug 25, 2010 10:24 AM

    Hi,
    If you don;t know any of them. I think you should take a little time to research or search from Google, SDN wiki,...
    regards,

  • How to convert my query to SQL Procedure

    Hi all,
    I am running an SQL Query in my page process to set few items on my page.
    begin
    declare
    l_vc_arr2 APEX_APPLICATION_GLOBAL.VC_ARR2;
    begin
    IF APEX_APPLICATION.G_F01.COUNT = 0 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a email template to edit!!!');
    END IF;
    IF APEX_APPLICATION.G_F01.COUNT > 1 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a single email template to edit at a time!!!');
    END IF;
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
    l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(APEX_APPLICATION.G_F01(i),'$');
    :P32_SUBJECT := l_vc_arr2(1);
    :P32_TYPE := l_vc_arr2(2);
    :P32_BODY := l_vc_arr2(3);
    END LOOP;
    end;
    end;
    It is running perfectly fine. Now i want to convert this query into custom procedure. I am writing follwing code to create SQL Procedure,
    create or replace
    procedure Edit_EmailTemplate as
    begin
    declare
    l_vc_arr2 APEX_APPLICATION_GLOBAL.VC_ARR2;
    begin
    IF APEX_APPLICATION.G_F01.COUNT = 0 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a email template to edit!!!');
    END IF;
    IF APEX_APPLICATION.G_F01.COUNT > 1 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a single email template to edit at a time!!!');
    END IF;
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
    l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(APEX_APPLICATION.G_F01(i),'$');
    v(P32_SUBJECT) := l_vc_arr2(1);
    v(P32_TYPE) := l_vc_arr2(2);
    v(P32_BODY) := l_vc_arr2(3);
    END LOOP;
    end;
    end;
    but it is not getting compiled. Do anyone know what the problem is???
    With Regards,
    Sunil Bhatia

    hey thanks,
    but my problem is not of creating,
    it has been created and i can see it in sql browser. but it is not getting compiled
    it is returning with the following error
    Compilation failed,line 18 (13:22:08)
    PLS-00306: wrong number or types of arguments in call to 'V'Compilation failed,line 18 (13:22:08)
    PL/SQL: Statement ignoredCompilation failed,line 19 (13:22:08)
    PLS-00306: wrong number or types of arguments in call to 'V'Compilation failed,line 19 (13:22:08)
    PL/SQL: Statement ignoredCompilation failed,line 20 (13:22:08)
    PLS-00306: wrong number or types of arguments in call to 'V'Compilation failed,line 20 (13:22:08)
    PL/SQL: Statement ignored
    my statement is
    create or replace
    procedure Edit_EmailTemplate as
    begin
    declare
    l_vc_arr2 APEX_APPLICATION_GLOBAL.VC_ARR2;
    begin
    IF APEX_APPLICATION.G_F01.COUNT = 0 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a email template to edit!!!');
    END IF;
    IF APEX_APPLICATION.G_F01.COUNT > 1 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a single email template to edit at a time!!!');
    END IF;
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
    l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(APEX_APPLICATION.G_F01(i),'$');
    v('P32_SUBJECT') := l_vc_arr2(1);
    v('P32_TYPE') := l_vc_arr2(2);
    v('P32_BODY') := l_vc_arr2(3);
    END LOOP;
    end;
    end;

  • How to find how much memory used by particular procedure or function.

    Hi,
    How can we find out memory used by particular procedure or function?
    If procedure or function is called many times in particular interver, wil it be cached in memory?
    and how will it affect performance?
    what type of pl/sql statement will take more time than normal sql statement?

    Hi
    There are several different memory issues to consider:
    - the code itself (stored in the shared pool)
    - simple variables defined in the code
    - complex variables (eg VARRAY, TABLE etc)
    There's a helpful note on PL/SQL profiling here - http://www.oratechinfo.co.uk/tuning.html - which mentions how to measure memory use (session PGA and UGA - that's program and user global areas)
    You can find out more about shared pool memory structures here - http://download-east.oracle.com/oowsf2005/003wp.pdf.
    Calling a function many times - yes, the function code will be cached (if possible). Session state (for a package) will also be retained (ie global package variables).
    If many users call the same function, there will be one copy of the code but many copies of the private state.
    Finally: PL/SQL statements that can take a long time include:
    - anything that does heavy processing inside a tight loop;
    - anything that waits (select for update; read from a pipe or dequeue from AQ etc)
    Probably the most common mistake is to use PL/SQL for relational processing that can be done from SQL itself (eg writing nested PL/SQL loops to join data that could have been queried in a single SQL statement. Try to minimise context switches between PL/SQL and SQL:
    - use bulk collect where possible
    - use set operations in SQL
    Good luck, HTH
    Regards Nigel

  • How can I use the procedures and functions in my library

    hello, all
    I have a pl/sql library MYLIB.pld, MYLIB.pll and MYLIB.plx.
    How can I invoke procedures and functions there in JDeveloper?
    Thanks.
    Damon

    I am indeed using ADF BC to re-develop the oracle application.
    Here is my situation:
    We have an oracle form application.
    Our objective is to try to re-use the existing sources in the form application as much as possible:
    1. tons of procedures and functions in a pl/sql library(a file with extension name portfolioLib.pll or portfolioLib.plx);
    2. tons of form-level triggers, data-block triggers and item-triggers;
    3. tons of database stored procedures and triggers;
    After doing a research on JDeveloper, we decide to use ADF Swing+ADF BC to re-develop the application.
    My opinion for the above three kinds of sources in our form application is:
    for 1: we try to move most of procedures and functions into database(except Form build-in);
    for 2: we try to wrap those triggers in a SQLJ class;
    for 3: we try to call database procedures and functions with PreparedStatment or CallableStatement;
    I just do a test on a post-query trigger on a data-block:
    I created a sqlj file, named testSQLJ.sqlj in the test.view package;
    I tried to call it in createInstanceFromResultSet of testDeptVOImpl.java which is test.model package,
    I was told that testSQLJ cannot be found there. why?
    How can I call some classes from test.view package in some classes of test.model?
    I read some documents about how to deal with post-query trigger in JDeveloper: create a view with SQL statement, but it seems that it does not support pl/sql statement there.
    Can you give me some opinion about the above stuff?
    I really appreciate your help.
    Damon

  • Explain plan in procedure or function

    Hi
    I want to know how can i do explain plan in procedure or function. Any ideas or solution how can i do that? ;/

    I mean inside function ;p
    When i try execute function I always get error:
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "HR.EXPLAIN_PLAN_SQL", line 34
    14551. 00000 - "cannot perform a DML operation inside a query "
    *Cause:    DML operation like insert, update, delete or select-for-update
    cannot be performed inside a query or under a PDML slave.
    *Action:   Ensure that the offending DML operation is not performed or
    use an autonomous transaction to perform the DML operation within
    the query or PDML slave.
    heh... I got this error because its pipelined function. I forget about that ;p
    Sorry for my english and thx for help. :)

  • Converting normal FM to RFC

    Hi All
    I am converting normal FM  to ZRFC. My normal FM- BBP_GET_UNITS_F4 has table parameters with table type. In RFC table type is not allowed and i changed the tables parameter into structure.
    Now inside my ZRFC, i am calling the normal FM. Here i am getting dump saying, "Type conflict when calling the function module "BBP_GET_UNITS_F4"."
    My RFC has table parameter with structure but normal FM is having a table type. Please tell me how to solve this issues
    Regards
    Vinoth

    This may help?
    RFC function TABLES parameter vs. IMPORTING table type parameters

  • Diif between Stored procedure and function

    HI
    I want all the differences between Stored procedure and function.
    Even the basic diff is Procedure does not return any value and Function must be...
    Thansk In advance...

    1) Functions are used for computations where as procedures can be used for performing business logic That's an opinion on usage not an actual difference.
    3) You can have DML(insert,update, delete) statements in a function. But, you can not call such a function in a SQL query.Not true. As User defind functons limitations we can use a function that issues DML in a SELECT statement, if it uses the PRAGMA AUTONOMOUS_TRANSACTION.
    4) Function parameters are always IN, no OUT is possibleEasily refutable...
    SQL> CREATE OR REPLACE FUNCTION my_f (p OUT NUMBER) RETURN DATE
      2  AS
      3  BEGIN
      4     p := to_number(to_char(sysdate, 'DD'));
      5     RETURN sysdate;
      6  END;
      7  /
    Function created.
    SQL> var x number
    SQL> var d varchar2(18)
    SQL> exec :d := my_f(:x)
    PL/SQL procedure successfully completed.
    SQL> print d
    D
    18-NOV-05
    SQL> print x
             X
            18
    SQL>
    Stored Procedure :supports deffered name resoultion Example while writing a stored procedure that uses table named tabl1 and tabl2
    etc..but actually not exists in database is allowed only in during creationNot sure what this one is about...
    SQL> CREATE PROCEDURE my_p AS
      2      n NUMBER;
      3  BEGIN
      4     SELECT count(*) INTO n
      5     FROM tab1;
      6  END;
      7  /
    Warning: Procedure created with compilation errors.
    SQL> sho err
    Errors for PROCEDURE MY_P:
    LINE/COL ERROR
    4/4      PL/SQL: SQL Statement ignored
    5/9      PL/SQL: ORA-00942: table or view does not exist
    SQL>
    7) A procedure may modifiy an object where a function can only return a value.An ounce of test is worth sixteen tons of assertion...
    SQL> CREATE OR REPLACE FUNCTION my_f2 RETURN VARCHAR2
      2  AS
      3  BEGIN
      4       EXECUTE IMMEDIATE 'CREATE TABLE what_ever (col1 number)';
      5      RETURN 'OK!';
      6  END;
      7  /
    Function created.
    SQL> exec :d :=  my_f2
    PL/SQL procedure successfully completed.
    SQL> desc what_ever
    Name                                      Null?    Type
    COL1                                               NUMBER
    SQL> I think there are only two differences between a procedure and a function.
    (1) A function must return a value
    (2) because of (1) we can use functions in SQL statements.
    There are some minor difference in allowable syntax but they are to do withj RETURN values.
    Cheers, APC

  • How to convert normal timestamp to julian timestamp in oracle

    Hi Friends
    How can i convert normal timestamp to Julian Timestamp in Oracle ?
    Thanks for your help

    Hi Chris,
    I dont have any idea on this. But need clarification on your query.
    When I executing below query I'm getting same output. 'J' will give only Julian day right not the timestamp. Please correct me if I am wrong.
    SQL> select to_char(systimestamp,'J') J,to_char(sysdate,'J') from dual;
    J            TO_CHAR
    2456631   2456631
    http://en.wikipedia.org/wiki/Template:JULIANDAY.TIMESTAMP

  • Checking for EXECUTE priviledges on any Procedure or Function

    Hi All,
    I know that the table DBA_SYS_PRIVS can be used to check the priviledges for any object.
    But after querying the view, I could see the priviledges on diff packages and other tables but could not find any Procedure or Function name ( Standalone or packaged) in the view.
    Where else could I find the same?
    Having execute priviledge on compelte package means having same on its contents( procs,functions etc)..is this right?
    Rgds,
    Aashish S.

    Aashish,
    You have object privileges (CREATE TABLE, ALTER TABLE and system privileges (ALTER SYSTEM, ALTER USER). They serve different purposed.
    DBA_SYS_PRIVS is for system privileges only.
    You can not have seen privileges on packages, at least not EXECUTE privileges.
    These are in DBA_TAB_PRIVS.
    Packages are granted at the package level.
    Sybrand Bakker
    Senior Oracle DBA

  • Stored procedure and function - return table type

    Hello again :)
    I have one simple question :) Maybe on this forum the question was asked, but I found only similar question and they didn't help me.
    It's possible return in Stored Function (with StoredProcedureFunction) as result return TABLE type? Or return table type with output parametr with Stored Procedure? Or instead of the table return the db object, but it is similar problem:)
    Now, I can using db types TABLES or DB OBJECTS as INPUT parameters with call stored functions or procedures, for example:
    I have this simple db object:
    create or replace type BUFFER_DATA_R as object( detail  VARCHAR2(4000 ))
    And this simple table:
    CREATE OR REPLACE TYPE BUFFER_DATA_T IS TABLE OF BUFFER_DATA_R
    I create simple domain class object:
    *public class DMBufferDataStruct {*
    public String bufferData;
    And I mapped in java with ObjectRelationalDataTypeDescriptor:
    ObjectRelationalDataTypeDescriptor descriptor = new ObjectRelationalDataTypeDescriptor();
    descriptor.setJavaClass(DMBufferDataStruct.class);
    descriptor.setTableName("BUFFER_DATA_T");
    descriptor.setStructureName("BUFFER_DATA_R");
    descriptor.setPrimaryKeyFieldName("DETAIL");
    descriptor.addFieldOrdering("DETAIL");
    descriptor.addDirectMapping("bufferData", "DETAIL");
    and join to server session ...
    Well, i using this doimain class object as input parametr wih stored procedure call:
    ObjectRelationalDatabaseField ordf = new ObjectRelationalDatabaseField("");
    ordf.setSqlType(Types.STRUCT);
    spCall.addNamedArgument(key, key,
    Types.ARRAY,
    "BUFFER_DATA_T",
    ordf);           
    query.addArgument(key);
    args.add(paramsInputs.get(key));
    in paramsInputs is Vector of DMBufferDataStruct...
    Well, this work fine!
    But I can not figure, how to return this table from output parameters of stored procedure or as a return value from stored function?
    Example of exceptions:
    The number of arguments provided to the query for execution does not match the number of arguments in the query definition. - return as output parameter
    PLS-00382: expression is of wrong type - used as result from stored function
    So, my question is: Is possible return this table type from stored procedure or function? And if YES, how can I set output argument for call?
    Thx advance!
    Sorry for my English! :)
    Best regards, KLD

    Your question is: what is faster PL/SQL or PL/SQL? And the answer is: it is PL/SQL of course!
    As a general rule, you use a function when you return exactly one result: a number or a string or (more complex) instance of an object type or REF CURSOR or PL/SQL collection.
    You use a procedure when:
    a) you just do the job and return no result
    b) you return multiple results - you can use multiple IN/OUT or OUT parameters
    Imagine you have to write a program unit that performs a partitioned table maintenance by adding a partition.
    You can implement this unit:
    a) if you want return a "status code" (0 on successful completion or non-zero in case of error) then you should use a function
    b) if you want no "status code" (in case of error an exception is raised that is handled outside of the program unit) then you should use a procedure
    c) if you want "status code", name of tablespace where a partition was created (assume you program is so complex that it can choose different tablespaces based on metadata and free space available) and free space in that tablespace after the creation of a new partition then you should use a procedure with 3 OUT parameters.
    But these are good programming practices that can be applied to (almost) any 3rd generation programming language, not only PL/SQL.

  • Convert a query form to Creation form.

    We create a normal jspx form and drag and drop a view object normal mode.
    When we open the form first record come
    Then We need to change this form to a creation form with new empty record.
    Form include many custom code.We can't recreate form.
    How can we do it?
    it means how Convert a query form to Creation form?
    we are using jdev 10.1.3.2
    Thanks

    You have to add Create method in PageDef.xml and then add expression in RefreshCondition to invoke it (in executables). For more information see:
    http://download-uk.oracle.com/docs/html/B25947_01/web_form006.htm#CACECCJA
    Kuba

Maybe you are looking for

  • Problem with post_login after Upgrade to 4.1.1.00.23

    Hi, i upgraded the APEX environment from 4.1 to 4.1.1.00.23 via p13331096_112020_Generic.zip. And now the page sentry NTLM via PL/SQL (see http://jastraub.blogspot.com/2008/03/ntlm-http-authentication-and.html) doesn't work :-( I think the cookie via

  • Image Rollovers w/ CSS

    I know how to make rollovers with CSS using a background image and browser text, but how would I use CSS to make rollover buttons from images (text and button are one image)? Brandon ================== Presentations Direct - Binding Machines, Laminat

  • Why has my new Yosemite begun to display purple, green and black

    why has my new Mac Yosemite begun to display un purple, green and black

  • Wake from hibernation results in crazy colors/shapes/flickering on screen

    Hello, I have a 3 week old 17" High-Res MBP and it is been working flawlessly until this morning. I let the battery run down to 0 overnight at which time the computer went into hibernation mode (latch light was off). The next morning I plugged in the

  • Listener failure

    I installed oracle on my win2003 and had 2 db (orcl and ora7) and it worked fine before. However, the listener fail to start again when I rebooted my machine. Here is the message when I type start in the LSNTCTL prompt. TNS-12536 : TNS : operation wo