PL\SQL challange !!!

hello all,
I have a table which has undergone several changes (addition of columns) in different versions.
Now, I want to write a stored procedure (having select, insert, and update like queries ) which would run successfully on all the versions of the table.......
performance is one of the major issues which I had to handle as this stored procedure is going to b invoked by many user concurrently.....
example of the above scenario:
I have a table employee(say) and have columns (say) c1 c2 c3 and some stored procedure sp1 in first version of the database.
now, in second release of the database I change the structure of the table "Employee" and added a new column c4(say), and changed my stored procedure sp1 accordingly......
the problem is that I want to write a common stored procedure which should run on both the versions of table without much degradation in the time, the queries would take to complete.....
please suggest me some to solve this problem effectively.
thanks and regards
abhijeet.

Hi Abhijeet,
One idea can be:
Create a product version table (if not already existing), and a sql_code_version table that can be shaped like:
VERSION_CODE_TABLE
..VER_NUM NUMBER
..TARGET_TABLE VARCHAR
..OPER_ID VARCHAR
..QUERY_TEXT
And insert in this table for example
V1,EMP,INSERT,INSERT INTO EMP VALUES :1,:2,:3
V2,EMP,INSERT,INSERT INTO EMP VALUES :1,:2,:3,:4
And in your proc code, for example for the insert statement:
1/ SELECT verision_number from your version_table
2/ SELECT QUERY_TEXT from your VERSION_CODE_TABLE with proper OPER_ID and TARGET_TABLE
3/ Bind the vars for use with execute immediate (or dbms_sql, even)
Some work is to be done about the number of parameters..... it might be unknown (what if you add a 5th field to emp? do you give the parameters to the procedure using one parameter or multiple parameters... ?
That might be a way valuable to look into.
HTH
Yoann.

Similar Messages

  • SQL Questions !

    Hi folks
    I am developing a solution in Excel. My challange is to query account balances for General Ledger and Accounts Receivalbe And Payable.
    SBO have report called Trail Balance -
    We want to get 3 values
    1. Opening balance
    2. Transactions
    3. End Balance
    Selection criteria is from/to posting date.
    Do SBO have stored values for Opening Balance and/or End Balances?
    Any suggestions to make a SQL query with posting date as variables. 3 values is to be retreived in Excel.
    Any suggestions?
    Best regards
    Geir Parlati

    I have this exact same challenge, Geir...  Have you found a way to do this - have you found an answer?  I'd sure like to know...
    Erik

  • Installation error 29506 on SQL Management Studio...

    hai......
    I've several ways in tried to install SQL management studio including running of cmd prompt as admin.But the installer shows that "the installer has encountered an unexpected error installing this package.This may indicate a problem with this package.The
    error code is 29506" ...........
    Please help me.....

    allright here is the answer
     Burn the  program on CD.
    Now lauch   Command prompt as Administrator.     ( Right click on command prompt to Run as Admin )
    Then  in black screen ( for those computer challanged lol )     ,  Change directory  to Your  CD    drive   ( mine is  D: )    .      (   I am old school and know some Dos commands.
     Now   from   D:  in command prompt in that black screen  type the name of file   with extension
    D:\SQL blah blah.  MSI
    This will lauch installer.
    WORKS    !!
    (  you are welcome  )

  • Deducing ranges and gaps in SQL

    The increment of val is one
    My example is:
    select * from t1
    d_no _________ val
    1 ____________ 20
    1 ____________ 21
    1 ____________ 22
    1 ____________ 23
    1 ____________ 25
    1 ____________ 1503
    1 ___________ 1504
    3 ___________ 502
    3 ___________ 503
    3 ___________ 504
    3 ___________ 600
    I am trying to come up with an SQL which would produce an output of
    d_no ___ the_range
    1 ______ 20-23
    1 ______ 25
    1 ______ 1503-1504
    3 ______ 502-504
    3 ______ 600
    I have tried using some of the analytic functions and got close with lead but not quite. I could do a cursor in
    PL/SQL but the table is so huge it takes way to long. In fact I did do this on a small table. It worked just fine.
    Also what I am showing as a table is really an in-line view of a couple of tables I have joined.
    Any ideas would really be helpful
    Thank you

    Hmm.. browser error or something. My earlier response to this posting has not shown up some hours later now..
    Anyway, here is it again. I like the challange of such interesting problems and had a bash at it. The result is usable - i.e. it shows sequences and gaps. But not in your required format. Using lead and lag with the select that deals with the gaps, you could likely change it to the format you wanted.
    SQL> create table ranges
      2  (
      3          inc     number,
      4          value   number
      5  )
      6  /
    Table created.
    SQL>
    SQL> insert into ranges values(1, 20);
    1 row created.
    SQL> insert into ranges values(1, 21);
    1 row created.
    SQL> insert into ranges values(1, 22);
    1 row created.
    SQL> insert into ranges values(1, 23);
    1 row created.
    SQL> insert into ranges values(1, 25);
    1 row created.
    SQL> insert into ranges values(1, 1503);
    1 row created.
    SQL> insert into ranges values(1, 1504);
    1 row created.
    SQL> insert into ranges values(3, 502);
    1 row created.
    SQL> insert into ranges values(3, 503);
    1 row created.
    SQL> insert into ranges values(3, 504);
    1 row created.
    SQL> insert into ranges values(3, 600);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> with RANGE_RESULTS as (
      2          select
      3                  t1.inc,
      4                  t1.value        as VALUE1,
      5                  t2.value        as VALUE2
      6          from    ranges t1,
      7                  ranges t2
      8          where   t1.inc = t2.inc (+)
      9          and     (t1.value+1) = t2.value (+)
    10  )
    11  select
    12          r.*
    13  from       RANGE_RESULTS r
    14  where      r.value2 is NULL
    15  union
    16  select
    17          t1.inc,
    18          MIN(t1.value1)          as VALUE1,
    19          MAX(t2.value2)          as VALUE2
    20  from       RANGE_RESULTS t1,
    21          RANGE_RESULTS t2
    22  where      t1.inc = t2.inc
    23  and        t1.value2 is not NULL
    24  and        t2.value2 is not null
    25  and        t1.value2 = t2.value1
    26  group by t1.inc
    27  /
           INC     VALUE1     VALUE2
             1         20         23
             1         23
             1         25
             1       1504
             3        502        504
             3        504
             3        600
    7 rows selected.
    SQL>

  • Logical Operations in SQL decode function ?

    Hi,
    Is it possible to do Logical Operations in SQL decode function
    like
    '>'
    '<'
    '>='
    '<='
    '<>'
    not in
    in
    not null
    is null
    eg...
    select col1 ,order_by,decode ( col1 , > 10 , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 , <> 10 , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 , not in (10,11,12) , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 ,is null , 0 , 1)
    from tab;
    Regards,
    infan
    Edited by: user780731 on Apr 30, 2009 12:07 AM
    Edited by: user780731 on Apr 30, 2009 12:07 AM
    Edited by: user780731 on Apr 30, 2009 12:08 AM
    Edited by: user780731 on Apr 30, 2009 12:08 AM
    Edited by: user780731 on Apr 30, 2009 12:09 AM

    example:
    select col1 ,order_by,case when col1 > 10 then 0 else 1 end
    from tab;
    select col1 ,order_by,case when col1 &lt;&gt; 10 then 0 else 1 end
    from tab;
    select col1 ,order_by,case when col1 not in (10,11,12) then 0 else 1 end
    from tab;As for testing for null, decode handles that by default anyway so you can have decode or case easily..
    select col1 ,order_by,decode (col1, null , 0 , 1)
    from tab;
    select col1 ,order_by,case when col1 is null then 0 else 1 end
    from tab;

  • Unable to capture the parameter values from a PL/SQL procedure

    hi.
    i'm trying to capture the parameter values of a PL/SQL procedure by calling inside a anonymous block but i'm getting a "reference to uninitialized collection error" ORA-06531.
    Please help me regarding.
    i'm using following block for calling the procedure.
    declare
    err_cd varchar2(1000);
    err_txt VARCHAR2(5000);
    no_of_recs number;
    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
    cntr_var number:=0;
    begin
         rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
         dbms_output.put_line('The error is ' ||err_cd);
         dbms_output.put_line('The error is ' ||err_txt);
         dbms_output.put_line('The cntr is ' ||cntr_var);
         for incr in 1 .. OUT_SIGN_TAB.count
         loop
         cntr_var := cntr_var + 1 ;
    Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN_TAB(incr).txn_type||','||OUT_SIGN_TAB(incr).objid);
    end loop;
    end;
    Error is thrown on "for incr in 1 .. OUT_SIGN_TAB.count" this line
    Following is some related information.
    the 3rd parameter of the procedure is a out parameter. it is a type of a PL/SQL table (SEARCH_SIGN_TAB_TYPE) which is available in database as follows.
    TYPE "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
    TYPE "SEARCH_SIGN_TYPE" AS OBJECT
    (ref_no VARCHAR2(22),
    ciref_no VARCHAR2(352),
    ac_no VARCHAR2(22),
    txn_type VARCHAR2(301),
    objid VARCHAR2(1024))............

    We don't have your rt843pq procedure, but when commenting that line out, everything works:
    SQL> create TYPE "SEARCH_SIGN_TYPE" AS OBJECT
      2  (ref_no VARCHAR2(22),
      3  ciref_no VARCHAR2(352),
      4  ac_no VARCHAR2(22),
      5  txn_type VARCHAR2(301),
      6  objid VARCHAR2(1024))
      7  /
    Type is aangemaakt.
    SQL> create type "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
      2  /
    Type is aangemaakt.
    SQL> declare
      2    err_cd varchar2(1000);
      3    err_txt VARCHAR2(5000);
      4    no_of_recs number;
      5    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
      6    cntr_var number:=0;
      7  begin
      8    -- rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
      9    dbms_output.put_line('The error is ' ||err_cd);
    10    dbms_output.put_line('The error is ' ||err_txt);
    11    dbms_output.put_line('The cntr is ' ||cntr_var);
    12    for incr in 1 .. OUT_SIGN_TAB.count
    13    loop
    14      cntr_var := cntr_var + 1 ;
    15      Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN
    TAB(incr).txntype||','||OUT_SIGN_TAB(incr).objid);
    16    end loop;
    17  end;
    18  /
    The error is
    The error is
    The cntr is 0
    PL/SQL-procedure is geslaagd.Regards,
    Rob.

  • Unable to capture SQL Server Schema

    I am trying to capture SQL Server 2005 demo schema (AdventureWorks). It does shows the numbers of Tables/Indexes captured..but finishes with this error..
    Error ocurred during capture: Exhausted Resultset
    Column not found. Skipping index detail on index 'IX_StoreContact_ContactTypeID'
    Column not found. Skipping index detail on index 'IX_StoreContact_ContactID'
    Column not found. Skipping index detail on index 'AK_StoreContact_rowguid'
    Column not found. Skipping index detail on index 'IX_ProductVendor_VendorID'
    Column not found. Skipping index detail on index 'IX_ProductVendor_UnitMeasureCode'
    Column not found. Skipping index detail on index 'IX_Address_StateProvinceID'
    Column not found. Skipping index detail on index 'IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode'
    Column not found. Skipping index detail on index 'IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode'
    Column not found. Skipping index detail on index 'IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode'
    Column not found. Skipping index detail on index 'IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode'
    Column not found. Skipping index detail on index 'IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode'
    Column not found. Skipping index detail on index 'AK_Address_rowguid'
    Column not found. Skipping index detail on index 'AK_Department_Name'
    Any help is appreciated..
    Ajay

    Hi Nandu,
    As your description, you come across an error(vsjitdebugger.exe cannot be found). Please confirm if the error occurs during the installation of SQL Server 2012.  If so, please help post SQL Server setup logs. By default, SQL Server setup log file locates
    in C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log.
    Base on my research, this error could be caused by that the previous uninstallation is improper and vsjitdebugger.exe file could be mistakenly deleted.
    To troubleshoot the issue, you could start your computer into Safe Mode and fix your problem with one of the following methods. For more information, please refer to the article:
    http://www.fixerrorkit.com/fix-error/fix-vsjitdebugger.exe-error.html.
    1. You could execute the sfc /scannow command following steps below.
    a. Press "Windows+R", type in cmd and then right click "Run as administrator"
    b. Type in sfc /scannow (There's a space between sfc and /scannow) into the dialog and hit Enter key and click ok.
    c. Wait until the System File Checker finishes the check.
    2. You could use a Windows repair installation, also known as a Startup Repair to repair your Windows system files.
    3. You could install the latest Windows updates to fix vsjitdebugger.exe error. Microsoft often releases new service packs and system patches to replace or update some DLL files of Windows system.
    4. You could use third-party tool such as Automatic Error Fix Tool to fix your vsjitdebugger.exe error. However, Microsoft cannot make any representations regarding the quality, safety, or suitability of any third-party software or information found there.
    In addition, if you are unable to install  Visual Studio, I suggest you post your question in Visual Studio Setup and Installation forum at
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vssetup  . It is appropriate and more experts will assist you.
    Regards,
    Michelle Li

  • NoClassDefFoundError: com/sap/sql/log/OpenSQLException

    I have developed a Java project. It consists of 2 SQLJ files and then a Java class. When I try to execute the Java program, I get a Java error:
    java.lang.NoClassDefFoundError: com/sap/sql/log/OpenSQLException
         at com.mbb.crrs.business.report.dao.ReportDAO.<init>(ReportDAO.sqlj:23)
         at com.mbb.crrs.business.report.dao.Test.main(Test.java:24)
    Exception in thread "main"
    I notice a similar problem on message: Re: Which jar to include com.sap.sql.log.OpenSQLException
    Is that something that I need to maintain for it to work? Thank you.

    Hi,
    the problem one year ago was that the SQLException class was not available through remote access. I don't know if that might have been changed meanwhile in the latest release.
    I implemented a simple work around: I caught every SQL-exception in the method where it was thrown, wrapped the exception message and any nested exception in a self written exception and threw this new exception. That worked fine.
    Regards, Astrid

  • AND / OR  truth table in SQL

    why null is introduced in the AND and OR truth table?when will a statement/part of a statement return a null value??
    |AND               |True          |False             |NULL??        |
    |True               |True          |False             |Null             |
    |False              |False          |False             |False           |
    |Null                |Null             |Null               |Null             |is it introduced in AND/OR truth table for the null containing row(s)??
    select employee_id,last_name,job_id,salary
    from employees
    wheere salary >= 1000
    And job_id like '%man%';
    how the statement after the where cluz can return null value??Edited by: sayantan chakraborty on Aug 14, 2009 11:36 AM

    sayantan chakraborty wrote:
    how either of X and Y will return a null value?can you put any example?is there any syntax/ command which will print the return value of a statement as null?Say you had a table with columns X and Y. As long as NOT NULL constraints WERE NOT defined these values could contain NULLs. Then if you apply the WHERE condition of X = Y you would have the case of NULL = NULL which results in UNKNOWN.
    Simple Example:
    SQL > WITH test_data AS
      2  (
      3          SELECT 1 AS X, 1 AS Y FROM DUAL UNION ALL
      4          SELECT 2 AS X, 2 AS Y FROM DUAL UNION ALL
      5          SELECT 3 AS X, 5 AS Y FROM DUAL UNION ALL
      6          SELECT 4 AS X, 6 AS Y FROM DUAL UNION ALL
      7          SELECT 1 AS X, NULL AS Y FROM DUAL
      8  )
      9  SELECT  *
    10  FROM    test_data
    11  WHERE   X = Y
    12  /
             X          Y
             1          1
             2          2

  • If statement in sql

    regarding the following sql:
    SELECT a.lname, a.fname, a.user_id, c.address, c.city,
    c.zip, c.addresstypeid, d.descriptor as state
    FROM users a, address c, maintstatetype d
    WHERE a.user_id = c.user_id(+)
    AND c.statetypeid = d.statetypeid(+)
    AND c.addresstypeid in (1,2,3,4)
    I have a database of users and addresses. Each user can
    have multiple addresses and the addresses are
    designated by addresstypeid. In plain english, what I want
    to pull is "If they have an addresstypeid of 1, pull that one
    only, if not, check if they have a 2 and use that, if not, check
    for a 3, etc..".
    Any help with this?

    What you want, then, is to pull the address with the minimum addresstypeid ..
    SELECT a.lname, a.fname, a.user_id, c.address, c.city,
    c.zip, c.addresstypeid, d.descriptor as state
    FROM users a, address c, maintstatetype d
    WHERE a.user_id = c.user_id(+)
    AND c.statetypeid = d.statetypeid(+)
    AND c.addresstypeid =
    (select min(c2.addresstypeid)
    from address c2
    where c2.userid=a.userid
    I'm not sure what this will do to your outerjoin, though. You might have to get funky with a union ...
    SELECT a.lname, a.fname, a.user_id, c.address, c.city,
    c.zip, c.addresstypeid, d.descriptor as state
    FROM users a, address c, maintstatetype d
    WHERE a.user_id = c.user_id
    AND c.statetypeid = d.statetypeid
    AND c.addresstypeid =
    (select min(c2.addresstypeid)
    from address c2
    where c2.userid=a.userid
    Union all
    SELECT a.lname, a.fname, a.user_id, to_char(null), to_char(null),
    to_char(null), to_char(null), to_char(null)
    FROM users a
    WHERE not exists
    (select 1
    from address c
    where c.userid=a.userid
    )

  • If statement in reqular sql statement

    Hi everyone;
    I am trying to alter some trigger if I am in a certain environment. here what I am trying to do in pseudo-code
    if ((select dbenv from environments) = 'DEV') THEN
    ALTER TRIGGER XXX disable;
    end if;
    this sql script will be run from sqlplus' comand line
    reminder I don't want to do that from package or a procedure

    this to just explain
    i think select in the IF is not allowed that way please see the examples below
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2  vename VARCHAR2(10);
      3  BEGIN
      4   SELECT ename INTO vename FROM EMP WHERE ename='BLAKE';
      5   IF vename='BLAKE' THEN
      6    DBMS_OUTPUT.PUT_LINE('data found');
      7   ELSE
      8     DBMS_OUTPUT.PUT_LINE('no data found');
      9   END IF;
    10* END;
    11  /
    data found
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2  vename VARCHAR2(10);
      3  BEGIN
      4   --SELECT ename INTO vename FROM EMP WHERE ename='SMITH';
      5   IF ((SELECT ename FROM EMP WHERE ename ='SMITH')='BLAKE') THEN
      6    DBMS_OUTPUT.PUT_LINE('data found');
      7   ELSE
      8     DBMS_OUTPUT.PUT_LINE('no data found');
      9   END IF;
    10* END;
    SQL> /
    IF ((SELECT ename  FROM EMP WHERE ename ='SMITH')='BLAKE') THEN
    ERROR at line 5:
    ORA-06550: line 5, column 7:
    PLS-00103: Encountered the symbol "SELECT" 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
    ORA-06550: line 5, column 50:
    PLS-00103: Encountered the symbol ")" when expecting one of the following:
    . ( * @ % & - + ; / at for mod rem <an exponent (**)> and or
    group having intersect minus order start union where connect
    ||
    but this is allowed
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2  vename VARCHAR2(10);
      3  BEGIN
      4   --SELECT ename INTO vename FROM EMP WHERE ename='SMITH';
      5   IF 'BLAKE'='BLAKE' THEN
      6     SELECT ename INTO vename FROM EMP WHERE ename='SMITH';
    7    DBMS_OUTPUT.PUT_LINE(vename);
      8   ELSE
      9     DBMS_OUTPUT.PUT_LINE('no data found');
    10   END IF;
    11* END;
    SQL> /
    SMITH
    PL/SQL procedure successfully completed.formated
    Message was edited by:
    devmiral

  • IF statement in SQL*Plus - how to do it

    Hi,
    In SQL*Plus script, I would like to keep conditional checking (IF statement) and proceed. For example, whatever is done in PL/SQL block below, want to do the same in SQL*Plus script, I know partly it can be done using VARIABLE keyword, conditional checking can be done using DECODE in SELECT statement, but I want to carry out a more complex requirement, hence I want to use IF statement somehow in SQL*Plus.
    Another question, how to do spooling in PL/SQL script, it can be done using UTL_FILE, any other option is there to achieve this.
    declare
    v_ind_count int;
    begin
    select count(1) into v_ind_count from user_indexes where index_name = 'index_object_name';
    IF v_ind_count > 0
    THEN
    dbms_output.put_line('index found');
    ELSE
    dbms_output.put_line('index does not exist');
    END IF;
    end;
    /

    Hello,
    SQL*PLUS has no scripting language. It can only execute SQL and PL/SQL scripts. There are some commands like SPOOL or SET but no commands for conditional statements. You should describe your requirements, maybe we can find a way.
    Or you can search the forum, maybe your question has already been answered
    [Google for SQL*PLUS + condition|https://www.google.de/search?q=site%3Aforums.oracle.com+"SQL*PLUS"+condition]
    # {message:id=4189517}
    # {message:id=4105290}
    how to do spooling in PL/SQL scriptFrom within PL/SQL you can use dbms_output, the spool has to be started by the calling SQL script when it is executed in SQL*PLUS. Or you can use utl_file, but then you can only write to a server directory, not into a client file. To give an advice we need more information about what you want to do.
    Regards
    Marcus

  • Partner Application written in other language than PL/SQL and Java

    I have an application written in another language than PL/SQL or Java. I want to integrate this application as an Partner apps where I use the same user repository as Portal.
    Can I integrate the application by calling a stored PL/SQL-procedure based on the PLSQL SSO APIs examples that authenticates the user based on the username/password in portal and redirects the user to the application ?
    Are there any examples / references where this has been done ?
    Jens

    Check out the PDK referance for URL-Services, which allow you to integrate with any web based service/content.
    http://portalstudio.oracle.com/servlet/page?_pageid=350&_dad=ops&_schema=OPSTUDIO

  • NULL and dynamic SQL

    If table testrh2 has the following columns and data
    col1 --> NULL
    col2 --> 2
    and table testrh has the following columsn and data
    col1 --> NULL
    How could I write a dynamic SQL statement to join on the nulls? I've written the following block as a starting point.
    declare
    cursor c1 is select col1 from isis.testrh;
    lval varchar2(1000);
    lval2 varchar2(1000);
    begin
    for r1 in c1 loop
    lval := 'select col2 from isis.testrh2 where col1 = '||r1.col1;
    execute immediate lval into lval2;
    dbms_output.put_line(lval2);
    end loop;
    end;

    You can't compare null values with '=' in Oracle SQL.
    Null can only be compared with <column> is null .
    You can see it when you try these two queries:
    select * from dual where null is null;  -- you will see one row
    select * from dual where null=null;  -- you will see no rowsThat's why you have to write something like
    (<column1>=<column1>   or   (<column1> is null and <column2> is null))This should also work with null:
    decode(<column1>,<column2>,1,0)=1By the way, why do you use dynamic sql?
    lval := 'select col2 from isis.testrh2 where col1 = '||r1.col1;
    I think you could replace your two lines ( lval:= ... AND execute immediate) by this:
    begin
      select col2
      into lval
      from isis.testrh2
      where decode(col1,r1.col1,1,0)=1;
      dbms_output.put_line('lval='||lval);
    exception
    when no_data_found then
      dbms_output.put_line('no data found'); -- or whatever you want
    end;Edited by: hartmutm on 02.10.2010 23:54

  • How do I connect to SQL Server with Muse?

    I want to query items from database and load it back to front end. Is there a way Muse can connect to sql server database?

    You cannot connect to databases via Muse at the moment. Please refer: http://forums.adobe.com/message/5090145#5090145
    Cheers,
    Vikas

Maybe you are looking for

  • LOVs in Reports6i

    When building my LOV on the parameter screen, I want to limit the values of one field based on a value from another field. When I tried it, I got an error about using a bind variable in the where clause. Any suggestion on how to do this?

  • How to back up contacts from iPhone?

    I downloaded iPhone 2.0 and then synced my phone. Somehow, all the information in AddressBook on my computer is gone. Luckily, it still exists on my iPhone. How do I put the information from my iPhone back onto the computer?

  • Forms and layers in 9 Pro

    New to Acrobat. Have 9 Professional 9.1.3. How can I create the same forms in different layers at 1 page document? For example: you open the file, see the first layer with the forms, fill them, click the button to check forms for completeness and cor

  • Question about ASE 15.7 kernel mode – process vs threaded

    Hi there, This question is related to upgrading Sybase ASE Server from version 15.5 to version 15.7 on Sun Solaris SPARC Operating System (Solaris 10). For the upgrade, I need to choose between threaded kernel and process kernel mode. 1> Is the proce

  • Image color in jpeg doesn't match backround color in web page

    I made a simple panel in photoshop and used the #number for the color selected to fill one side of the panel in my CSS code. When the page is rendered there's a very slight difference between the panel and the background which I expect to be exactly