How to Use Dynamic SQL

Can anybody please send me a small program on How to Use Dynamic SQL.
How to execute and run give details.
Thanks
null

You can certainly use the INTO (and USING) clauses of EXECUTE IMMEDIATE to pass in and return data, i.e.
EXECUTE IMMEDIATE sqlStmt
  USING variable1, variable2
   INTO output1, output2The more complex the statement, however, the more appropriate DBMS_SQL is. DBMS_SQL also has the potential to allow you to use bind variables rather than reparsing the statement many times.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • How to use dynamic SQL in this case for best performance

    I have the table with following columns
    ID NUMBER,
    DATA LONG,
    TAG VARCHAR2(255)
    Records in this table will be like following
    1 this is an abstract ABSTRACT
    1 this is author AUTHOR
    1 100 PRICE
    2 this is an abstract ABSTRACT
    2 this is author AUTHOR
    3 contract is this CONTRACT
    Basically all the records with the same number constitute 1 record for another table. Tag in the above table indicates that what column it is and DATAwill have the actual data for that column. I need to populate the second table based an the above table but will not get the same number of TAGS all the time. I need to insert the values only for the columns provided in the TAG field. How will I accomplish this by dynamic sql. Do I create a loop and create two strings one with columns and one with values and then combine them and use execute immediate to insert into table? Is there an easier way to do this??
    Please respond quickly.
    Thanks
    Bhawna
    null

    > so which collection should i use to perform it..
    so that performance is best......
    Program to interfaces. That way, you can switch out implementations and test for yourself which performance is best in an actual production context. But first, write your program so that it works. Worry about refactoring for performance once your program is written and it works.
    > plz send me the logic....
    Give it a shot on your own first; we can help if you get stuck.
    ~

  • How to use Dynamic SQL in ABAP

    If I have mara table and I have an selection screen where I have allowed user to select the fields of MARA,Now What I want is depending on his selection we should be able to execute the sql command.
    E.g.
    Tables: mara.
    selection-screen
    MATNR , ERSDA , ERNAM , MTART , MEINS.
    NOW THE OUTPUT SHOULD BE ABLE TO DISPLAY ONLY THE SELECTED FIELD VALUE.

    Hello Nandan,
    Try the following code. It works.
    tables: mara.
    data: tablename  type tabname,
          fname      type fieldname,
          fieldnames type fieldname occurs 0.
    field-symbols : <fs_tableline> type any,
                    <fs_fieldval>  type any.
    initialization.
      tablename = 'MARA'.
      assign (tablename) to <fs_tableline> .
      fname = 'MATNR'.
      append fname to fieldnames.
      fname = 'MTART'.
      append fname to fieldnames.
    select (fieldnames)
      from (tablename)
      up to 20 rows
      into corresponding fields of <fs_tableline>.
      loop at fieldnames into fname.
        assign component fname of structure <fs_tableline> to <fs_fieldval>.
        write : <fs_fieldval>.
      endloop.
      new-line.
    endselect.
    The <b>tables</b> statement is very important. You should at least have the list of the tables which you expect the user to enter.
    Please do get back if you have any doubts. If you think the question is answered, please reward the points to the useful answers and close the thread.
    Regards,
    Anand Mandalika.

  • Using dynamic sql in triggers with :OLD values

    i need to record all deleted rows from an entire schema in a single table. for that matter i created a function that receives a table name and generate an insert command according to it's primary key columns. i call this function in the table triggers. in order to insert the old values before the delete i use :OLD with "execute immediate" as followed :
    create or replace trigger trg_some_tbl_bd
    before delete on some_tbl
    for each row is
    declare
    v_sql varchar2(4000);
    begin
    v_sql := generate_insert_command('some_table');
    execute immediate v_sql;
    end;
    the return value from "generate_insert_command" function is the string:
    insert into deleted_table (table_name , date , pk1 , pk2) values
    ('some_table' , sysdate , :OLD.pk1 , :OLD.pk2)
    the execute immediate command notice the :OLD and looks for bind variables.
    i need to know i can i bypass that. i tried looking for escape characters but couldent find any...
    i would appriciate any help , it's kynda urgent
    Thanks !

    I don't believe this is going to work. Even if you could get around the fact that :old looks like a bind variable, the :old values are not visible to the dynamic SQL statement, they're like local variables in that respect.
    If you wanted to pass old values in, those values would have to be passed in as bind variables, i.e.
    EXECUTE IMMEDIATE v_sql USING :old.pk1, :old.pk2which defeats the purpose of using dynamic SQL.
    Since you have to create a trigger for each table, I don't see why you would bother with dynamic SQL inside the trigger-- your table structure is fixed when the trigger is created. You could write dynamic SQL that generated the triggers in the first place, but the code inside the trigger should be dynamic.
    As an aside, you realize that logging every audit record into a single table creates rather massive contention issues, right? And have you considered how painful it is to query this sort of table? Have you considered other options for maintaining history like Workspace Manager? Or at least separate history tables for each table?
    Justin

  • JDBC, Using Dynamic SQL

    How to implement dynamic SQL (like dynamic SQL Method 4 in Pro*C), which
    lets program accept or build dynamic SQL statements that contain an unknown
    number of select-list items or placeholders?

    You don't need the Oracle specific stuff. You can use ResultSetMetadata to analyze what your SQL statement returned. (I assume that's what you mean with "number of select-list items"). Basically:Statement stmt = connection.createStatement();
    boolean hasResult = stmt.execute(sql);
    if (hasResult)
      ResultSet rs = stmt.getResultSet();
      ResultSetMetadata meta = rs.     getMetaData();
      for (int c=0; c < meta.getColumnCount(); c++)
         System.out.println("Column: " + meta.getColumnName(c + 1); // column number starts at 1!
    }You will not be able to check whether your statement contains parameters/placeholders (to be used with PreparedStatements) because the Oracle driver does not implement the necessary methods.

  • How to use dynamic parameter when a report is created using Stored Procedures

    Hi all,
    any one have the idea of how to use dynamic parameter in crystal report XI R2
    when report is created using Stored Procedure.
    Regards
    shashi kant chauhan

    Hi
    You can create an SQL command in Database Expert > Expand your datasource > Add command
    Then enter the SQL query that will create the list of values to supply to the user
    eg select field1,field2 from table
    Then edit the parameter of the report.  These will be the SP parameters adn can be seen in field explorer.
    Change the parameter type to Dynamic
    Under the word Value click on Click here to add item
    Scroll down to your Command and select one of the values that you want to appear in the list
    e.g field1
    Then click on the Parameters field - this is essential to create the param
    You can edit other options as required
    That should do it for you.
    I must say that i use CR 2008 connected to Oracle 10g SP, but i reckon this will work for SQL DB and CR XI as well
    Best of luck

  • Can we use Dynamic SQL in Oracle Reports ?

    Hi ,
    Can we use Dynamic SQL in Oracle Reports ?
    If yes please give some examples .
    Thanx
    srini

    I believe the built-in package SRW.Do_Sql is what you are looking for
    Example from the document:
    /* Suppose you want to create a "table of contents" by getting the
    ** first character of a columns value, and page number on which its
    ** field fires to print. Assume that you want to put the "table of
    contents"
    ** into a table named SHIP. You could write the following construct:
    DECLARE
    PAGE_NO NUMBER;
    PAGE_FOR INDEX NUMBER;
    SORT_CHAR CHAR(1);
    CMD_LINE CHAR(200);
    BEGIN
    SORT_CHAR := :SORT_NAME ;
    IF :CALLED = Y THEN
         SRW.GET_PAGE_NUM(PAGE_FOR_INDEX);
         SRW.USER_EXIT(RWECOP PAGE_FOR_INDEX
         P_START_PAGENO);
         SRW.MESSAGE(2,TO_CHAR(:P_START_PAGENO));
    END IF;
    SRW.GET_PAGE_NUM(PAGE_NO);
    CMD_LINE := INSERT INTO SHIP VALUES
                          (||SORT_CHAR||,||TO_CHAR(PAGE_NO)||);
    SRW.MESSAGE(2,CMD_LINE);
    SRW.DO_SQL(CMD_LINE);
    COMMIT;
    EXCEPTION
      WHEN DUP_VAL_ON_INDEX THEN
            NULL;
      WHEN SRW.DO_SQL_FAILURE THEN
            SRW.MESSAGE(1,FAILED TO INSERT ROW INTO SHIP TABLE);
      WHEN OTHERS THEN
           COMMIT;
    END;

  • Hi experts, how to use open sql to read data from one " maintenance view"?

    i want to use this part of data within report ,so how to use open sql statement to read data from one " maintenance view"?

    Hi
    You can't use OPEN SQl statements to fetch data from maintenance view
    You have to use only Database views
    see the different types of views and the difference
    The followings are different types of views:
    - Database View (SE11)
    Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
    In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
    - Help View ( SE54)
    Help views are used to output additional information when the online help system is called.
    When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
    - Projection View
    Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
    A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
    - Maintenance View ( SE54 )
    Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
    Please have a look at below link. It will help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
    for more detailed info look on:
    http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
    Reward points for useful Answers
    Regards
    Anji

  • Getting error while using DYNAMIC SQL

    Hi Team,
    I am Oracle DBA. I have limited knowledge on PL/SQL. I used below PL/SQL code to drop 50 partitons from one of the table.
    I used Dynamic SQL EXECUTE IMMEDIATE to drop partions. But error occured. If I commented EXECUTE IMMEDIATE, procedure executed successfully.
    Please suggest me, where i did the mistake. Also please suggest for better code than my code. please find below code and error details.
    SQL> ed
    Wrote file afiedt.buf
    1 DECLARE
    2 CURSOR DROP_PARTITON IS select partition_name from user_tab_subpartitions where PARTITION_NAME<='ABCD_2011_04';
    3 BEGIN
    4 for curr IN DROP_PARTITON LOOP
    5 DBMS_output.put_line(curr.partition_name);
    6 execute immediate(Alter table Table_Name drop partition curr.partition_name);
    7 end loop;
    8* END;
    SQL> /
    execute immediate(Alter table BILLCHRG drop partition curr.partition_name);
    ERROR at line 6:
    ORA-06550: line 6, column 19:
    PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternative
    SQL> ed
    Wrote file afiedt.buf
    1 DECLARE
    2 CURSOR DROP_PARTITON IS select partition_name from user_tab_subpartitions where PARTITION_NAME<='ABCD_2011_04';
    3 BEGIN
    4 for curr IN DROP_PARTITON LOOP
    5 DBMS_output.put_line(curr.partition_name);
    6 --execute immediate(Alter table TABLE_NAME drop partition curr.partition_name);
    7 end loop;
    8* END;
    SQL> /
    ABCD_2009_06
    ABCD_2009_06
    ABCD_2009_06
    BILLCHRG_2011_04
    PL/SQL procedure successfully completed.

    PL/SQL code runs on the server, inside an Oracle process - thus PL/SQL code cannot dynamically write and display messages to the client. That server process is not connected to any keyboard, mouse or display.
    DBMS_OUTPUT can be used. This is a PL/SQL buffer area in that server process that code can write lines of text too. When the server process informs the client that it has completed, the client can now request the contents of the DBMS_OUTPUT buffer and the client can display it on the client device.
    This is what set serveroutput on in SQL*Plus does - tell the sqlplus client to request the DBMS_OUTPUT buffer after each Oracle server call made and to display the contents locally.
    So to display the SQL command can be done using DBMS_OUTPUT. E.g.
    declare
      dropPart varchar2(32767);
    begin
      for c in (select...) loop
        dropPart := 'alter table my_tab drop partition '||c.partition_name';
        --// write the SQL command to DBMS_OUTPUT
        DBMS_OUTPUT.put_line( dropPart );
        --// execute the SQL using a begin..end block in order to catch error
        begin
          execute immediate dropPart;
          DBMS_OUTPUT.put_line( 'command completed successfully' );
        exception when OTHERS then
          DBMS_OUTPUT.put_line( 'command failed with: '||SQLERRM(SQLCODE) );
        end;
      end loop;
    end;So after this code block has been executed and partitions dropped, sqlplus will display the DBMS_OUTPUT generated by this code block.

  • How to use dynamic select query which queries from 3 different table.

    Hi All,
    I am new to Toplink, i would like to use a named query to select some of the columns from 3 different tables with dynamic where clause.
    I have used the following lines. Please tell me how to get code for the dynamic where clause.
    First try :
    Vector objPersons = (Vector)session.executeQuery("findPersonByGlobalID",Person.class,vQueryArguments);
    The above method is not returning the vector or collection.
    Second Try:
    ReadAllQuery query = new ReadAllQuery(Person.class);
    query.useCollectionClass(LinkedList.class);
    LinkedList person = (LinkedList) session.executeQuery(query);
    The second try is returning the collection but, this fetches all the record from the table.
    1. How to query for range of records?
    2. How to query from multiple tables for some range. How to use dynamic range values ?
    Please reply with your answers or some pointers would help.
    Thanks and Regards,
    Vijay.B

    Hi,
    Did you try using a SQLCall ? It might be able to satisfy you requirements .. :-
    Employee employee = (Employee) session.executeSelectingCall(
        new SQLCall("SELECT * FROM EMPLOYEE WHERE EMP_ID = 44")
    );You can get more information here :-
    http://www.oracle.com/technology/products/ias/toplink/doc/1013/MAIN/_html/qrybas004.htm
    Regards,
    Sandeep

  • Delcare Cursor using Dynamic SQL using PL/SQL in Oracle 7.3.4

    In Oracle 7.3.4, can I declare a cursor at run time using Dynamic SQL. From the sample code in this website, it seems that Oracle 8 support this function. Please help. Thanks a lot.
    If I can do this on Oracle 7.3.4, could you give me some sample codes? Thanks.
    Regards,
    Raymond

    Hi,
    Try using the the following code where you can dynamically build the Valid Select stmt. and call that where ever you want.
    declare
    Type Cur_ref Is Ref Cursor;
    C_ref Cur_ref;
    V_Str Varchar2(100);
    V_Name Varchar2(100);
    Begin
    V_Str := 'Select Ename from Scott.emp Where empno = 7369';
    Open C_Ref for V_Str;
    Fetch C_ref Into V_Name;
    close C_Ref;
    dbms_output.put_line(V_Name);
    End;
    regards
    gaurav
    null

  • How to use dynamic list box in survey builder?

    Hello,
    Could someone give me a little bit of thread? How to use dynamic list box in survey builder?

    Hi Liu,
    Dynamic combo boxes::A combo box is dynamic if it references a document property for which a value set is defined in the configuration (System Administration ® System Configuration ® Content Management ® Global Services ® Property Metadata ® Properties ® Parameter Allowed Values).
    At runtime (when you open the creation form) the system reads these values from the configuration and displays them in the dropdown list.
    If you link a combo box for which list entries already exist to a document property with a value set, the system asks whether you want to delete the list entries. it is recommend that you accept this suggestion and delete the list entries from the XML Forms Builder. Otherwise inconsistencies could arise between the entries in the XML Forms Builder and the value set in the configuration. This can cause errors when saving.
    Also you may Refer the Link for Further help:
    http://help.sap.com/saphelp_crm50/helpdata/en/29/c40d3d2a83752de10000000a114084/frameset.htm
    http://help.sap.com/saphelp_crm50/helpdata/en/00/9e7f41969e1809e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_crm50/helpdata/en/a7/5a874174a8050de10000000a1550b0/frameset.htm
    Hope it Answers your Queries..
    Thanks and Regards,
    RK.

  • Using Dynamic SQL in Forms

    Does anyone know anything about Dynamic SQL not being available in Forms v. 6.0.8.11.3? I trying to use Dynamic SQL for the first time and am having some difficulty. When I try to put my SQL in a function and run it straight into the database through SQLPlus, it works fine, but when trying to compile the code in Forms Builder (in a library), I get compiler errors. Any help would be appreciated...
    Thanks!
    Vanessa

    When I tried to compile the following code in Forms, the compiler error I got was Encountered the symbol "STMT_STR" when expecting one of the following: select. However, when I run it in SQLPlus, it creates the function without any errors.
    FUNCTION my_func
    return number
    is
    TYPE DiaryCurTyp IS REF CURSOR;
    cur DiaryCurTyp;
    stmt_str VARCHAR2(200);
    dmonth NUMBER;
    dday NUMBER;
    BEGIN
    stmt_str := 'SELECT dmonth, dday FROM p2_diary
    WHERE dmonth = :1';
    OPEN cur FOR stmt_str USING '12';
    LOOP
    FETCH cur INTO dmonth, dday;
    EXIT WHEN cur%NOTFOUND;
    -- <process data>
    END LOOP;
    CLOSE cur;
    END;

  • How to use dynamically column_name and column_name value in plsql procedure

    hi,
    how to use dynamically column_name and column_name value in plsql procedure.
    for example, i have one table with column col1.i want write plsql code with dynamically execute the insert one schema to another schema.
    by
    siva

    DECLARE
    CURSOR C
    IS
    SELECT cc_cd
    FROM TEMP1 WHERE s_flg ='A' AND b_num IN('826114');--,'709537','715484');
    CURSOR D
    IS
    SELECT * FROM cONSTRAINTS_test ORDER BY SRL_NUM;
    STMT VARCHAR2(4000);
    p_target_schema VARCHAR2(30):='schema1';
    p_source_schema VARCHAR2(30):='schema2';
    BEGIN
    FOR REC IN C
    LOOP
    FOR REC1 IN D
    LOOP
    STMT := 'INSERT INTO '||p_target_schema||''||'.'||''||REC1.CHILD_TABLE||' SELECT * FROM '||p_source_schema||''||'.'||''||REC1.CHILD_TABLE||' where '||REC1.COLUMN_NAME||'='||REC.cntrct_cd||'';
    Dbms_Output.Put_Line('THE VALUE STMT:'||STMT);
    END LOOP;
    END LOOP;
    END;
    cc_cd='434se22442ss3433';
    cc_t_ms is parent table-----------------------pk_cc_cd is primary key
    cc_cd is column name
    CONSTRAINTS_test table
    CHILD_TABLE NOT NULL VARCHAR2(30)
    CONSTRAINT_NAME NOT NULL VARCHAR2(30)
    COLUMN_NAME NOT NULL VARCHAR2(400)
    R_CONSTRAINT_NAME VARCHAR2(30)
    CONSTRAINT_TYPE VARCHAR2(1)
    PARENT_TABLE NOT NULL VARCHAR2(30)
    SRL_NUM NUMBER(4)
    CHILD_TABLE     CONSTRAINT_NAME     COLUMN_NAME     R_CONSTRAINT_NAME     CONSTRAINT_TYPE     PARENT_TABLE     SRL_NUM
    a aaa cc_CD     pk_cc_CD     R     cc_t_MS     1
    bb     bbb      Cc_CD     PK_CC_CD     R     cc_t_MS     2
    bb_v     bb_vsr     S_NUM     PK_S_NUM      R     bb_v      3
    cC_HS_MS     cc_hs_CD     cc_CD     PK_CC_CD     R     cc_t_MS     4
    cC_HS_LNK cc_HIS_LNK_CD     H_CD     PK_HS_HCD     R     cC_hs_ms 5
    cC_D_EMP     cc_d_EMP     Cc_CD     PK_CC_CD      R     cc_t_MS     6
    i want insert schema1 to schema2 with run time of column_name and column value.the column_name and values should dynamically generated
    with refential integrity.is it possible?
    can any please quick solution.its urgent
    by
    siva

  • ORA-01006 using Dynamic SQL

    Hello,
    I'm trying to create a function utilizing Dynamic SQL. The function compiles fine, but when I go to call it using the select staement below, I get :
    ORA-01006: bind variable does not exist
    ORA-06512: at "ICIM.PROD_SALES_DATA", line 24
    select prod_sales_data('09','I',2009,'Awning')
    from dual;
    CREATE OR REPLACE FUNCTION prod_sales_data
    (p_ahl1 IN VARCHAR2, p_phl1 IN VARCHAR2, p_fisyr IN NUMBER,
    p_prod_str IN VARCHAR2)
    RETURN NUMBER IS
    v_return NUMBER;
    query_str VARCHAR2(10000);
    BEGIN
    query_str :='select sum(a.qsh*a.unitcnt)'||chr(13)
    ||'from sh_units a, sh_product_desc b, sh_ad_glass c'||chr(13)
    ||'where a.unittype = b.unittype'||chr(13)
    ||'and a.sh_id = c.sh_id(+)'||chr(13)
    ||'AND a.ahl1 = '||chr(39)||p_ahl1||chr(39)||chr(13)
    ||'AND a.phl1 = '||chr(39)||p_phl1||chr(39)||chr(13)
    ||'AND a.fisyr ='|| p_fisyr||chr(13)
    ||'AND UPPER(b.descrip) = UPPER('||chr(39)||p_prod_str||chr(39)||')'||chr(13)
    ||'AND a.invdt between b.eff_beg and b.eff_end'||chr(13)
    ||'and a.parts_flag <>'||chr(39)||'Y'||chr(39)||chr(13)
    ||'and a.unittype <>'||chr(39)||'OTHE'||chr(39)||chr(13)
    ||'and icim.sh_rept_chk_ortp(a.ortp) = 1'||chr(13)
    ||'and A.REPT_RELEASE_DT is not null';
    DBMS_OUTPUT.PUT_LINE(query_str) ;
    EXECUTE IMMEDIATE query_str
    INTO v_return
    USING p_ahl1,p_phl1,p_fisyr,p_prod_str;
    RETURN v_return;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END prod_sales_data ;
    Any help as to what is going wrong would be greatly appreciated.
    Thanks,
    Tyler

    Hello,
    >
    I'm trying to create a function utilizing Dynamic SQL. But why?
    Whenever you turn towards dynamic SQL, ask yourself why?
    I bet for a couple of years you aren't able rto come up with an answer. Meaning you shouldn't.
    Even if you do come up with an answer, think again. The answer may very well be wrong.
    Wouldn't it be nice if your function was as simple as:
    CREATE OR REPLACE FUNCTION prod_sales_data
       ( p_ahl1      IN VARCHAR2
       , p_phl1      IN VARCHAR2
       , p_fisyr     IN NUMBER,
         p_prod_str  IN VARCHAR2)
    RETURN NUMBER
    IS
       v_return NUMBER;
    BEGIN
        select sum(a.qsh*a.unitcnt)
          into v_return
          from sh_units a
             , sh_product_desc b
             , sh_ad_glass c
         where a.unittype = b.unittype
           and a.sh_id = c.sh_id(+)
           and a.ahl1 =  p_ahl1
           and a.phl1 =  p_phl1
           and a.fisyr = p_fisyr
           and upper(b.descrip) = upper(p_prod_str)
           and a.invdt between b.eff_beg and b.eff_end
           and a.parts_flag != 'Y'
           and a.unittype != 'OTHE'
           and icim.sh_rept_chk_ortp(a.ortp) = 1
           and a.rept_release_dt is not null;
    RETURN v_return;
    EXCEPTION
       WHEN NO_DATA_FOUND THEN
          RETURN NULL;
    END prod_sales_data ;
    /Now using proper bind variables, plain static pre-compiled SQL. And even works properly WITH NO DATA FOUND.
    I know it's dangerous to use words as always and never, but i dare say
    Always (Whenever you can) use static SQL. Never (Unless you must) use dynamic SQL (When you can use static).
    Regards
    Peter

Maybe you are looking for

  • 3 DVI monitor not working after upgrade

    I have three monitors connected to my new Mac pro via Active Minidisplay port to DVI adapters. They are all Dell 24" (1 2407,and 2 2405) they worked fine on 10.9.2 but after the upgrade to 10.9.3 only two monitors will work now. Verfiied that I was f

  • Updating data in HR - Infotypes

    Hi Experts,      I am currently working in HR ABAP. We have a requirement like updating details for infotypes 0002, 0006, 0009, 0022, 0023, 0024 and 0185.      There are standard generic function groups available (like for 0002 - HRXSS_PER_P0002_XX).

  • How to restore trashed events

    I trashed some events in FCPX 10.1.1 According to the manual I should be able to restore these but I cannot work out how to do this. The events did not go into the finder trash, so I presume there is a trash withing the FCPX library, but I cannot fin

  • SAPGUI7.10rev9 on 64bit Linux - Connection failed

    Hi, I installed SAPGUI7.10rev9 on 64bit Linux and try to connect to the SAP Netweaver2004s Test Drive. The connection failed: Attempt to load shared library /opt/SAPClients/SAPGUI7.10rev9/bin/libJPlatin.so failed. The library file exists, so either t

  • Randomly changing zoom method in Illustrator CC

    Does anyone know how to change the zoom method from 'marquee zoom' (zooms to box drawn on screen) to the newer 'scrubby zoom' (click and hold while moving mouse zooms drawing in and out) and back again...mine seems to be changing at random or I am hi