Need small sql help

wishing you all a Happy new Year !
In my prepared statement the sql query contains a part like
some sql+" AND UPPER(SUPPLIER.NAME) IN ( '"+supplierName+"' ) AND " + some sql
here supplierName is passed into the query as an atrubute.
But since supplierName = ADAM'S BIG HOTEL it throws and exception when executing the query becos of ' character.
Cos the program reads it like UPPER(S.NAME) IN ( 'ADAM'S BIG HOTEL' ) AND RS_BKG.BOOKING_S
Please advice me how to overcome this problem?
thrown exception is java.sql.SQLException: ORA-01756: quoted string not properly terminated
Many thanks

Use PreparedStatement [1]. It not only eases setting Java objects in a SQL query, but it also prevents you from SQL injections [2]. There is an excellent JDBC tutorial here at Sun.com [3]. It also covers the PreparedStatement [4].
[1] http://java.sun.com/j2se/1.5.0/docs/api/java/sql/PreparedStatement.html
[2] http://en.wikipedia.org/wiki/SQL_injection
[3] http://java.sun.com/docs/books/tutorial/jdbc
[4] http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html

Similar Messages

  • Need small help

    Hi,
    I need small help in sql*loader.I get data-files which has a particular identified on the 1st record( header ), based on which I've to load a constant for the 1st column of every row. How do I set in the control file.
    Appreciate if someone can give me directions on this.
    Thanks in advance,

    Hi again!
    I hope that a little shell script will do the thing for you.
    1.) Create the following BASH-Script
    #!/bin/bash
    export CUSTNO=""
    export CUSTNO=$(awk -F"," '{print NR " " $3}' datafile.csv | grep 1 | cut -d" " -f2)
    sed -i 's/#x#/'$CUSTNO'/g' controlfile.datI've use datafile.csv as the name of the datafile to load and controlfile.dat as the name of your controlfile. Please change this to fit your needs.
    This script looks for the occurrence of your constant value and stores this value in the variable CUSTNO. Then it look for a string #x# in your controlfile and changes #x# to the value of CUSTNO.
    So in your controlfile there should be a line for custno like that:
    custno                     CONSTANT '#x#'This line will be replace in your example to:
    custno                     CONSTANT '35642'To get this to work I assume that:
    1.) Your constant value is always at the third position in the header of your datafile.
    2.) You've made the change with #x# in your controlfile.
    I hope that this is really usefull to you.
    Best Regards
    Florian W.

  • VCM installation help needed on SQL DB and Reporting server

    Hi All,
    I'm new to VCM and now i got stuck at the SQL DB and Report server portion.
    I'm running the vcm server on VM and the SQL is a physical server, both are sitting on the same LAN.
    I have create the SQL DB but VCM just fail to validate the DB and report server.
    I login to VCM using a Domain account for installation, and i tried to testing the DB using ODBC from the window, result fail.
    Error message as attach.
    I'm now totally lost on SQL portion.
    My Question:
    Is there any configuration needed on SQL DB?
    How to get the reporting server to working?
    What port is needed to it all working??
    VCM server Ms Win2012.
    SQL version 2012.
    Many thanks to all who reply.

    Hi Simonhoo79,
    For SSRS,   first check whether the report server link is accessible from your browser : "http://s01-fes-vcm1:80/ReportServer" . If you continue to get 404 error there also, then you need to reconfigure you report server first before proceeding to vcm installation. Follow the steps on below link on how to reconfigure report server using report services configuration Manager for 404 error.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/75910bcb-a879-4eb7-9757-acc45201fa3a/can-not-connect-to-reportserver-http-404-file-not-found?forum=sqlexpress
    For SQL server ODBC connection,
    Dont create ODBC connection for SQL Native Client. Create ODBC connection for SQL Server.
    1. Open ODBC Data Source Administrator
    2. Click User DSN tab and Click Add button.
    3. Select SQL server and click finish
    4. Give name and description and Give the SQL server name (with instance name if your using named instance) or IP in the Server text box.
    5. Click Next and select either Windows authentication or sql authentication based on your SQL server authentication mode and click next.
    6. If the details given are correct then it will proceed further and  check "Change the dafault database to" to your VCM database
    7. Click next and finish and try test data source.
    VCM 5.7.2 and below will support installation only on windows server 2008 R2  and it doesn't support windows server 2012  but it support both 2008 and 2012 sql servers.

  • SQL help needed please

    Hi - using asp/vbscript/access
    I struggle with a small SQL issue and hope that someone can
    assist me;
    I have one db table, lets call it "test".
    Coloumns are ID, SubID, Name
    ID holds the uniqe ID and headline for each record ( Name).
    SubID holds the content linked to the corresponding ID.
    Something like this;
    ID1 - Shoe sizes
    ID2 / SubID 1 - 40
    ID3/ SubID 1 - 41
    ID4/SubID 1 - 42
    ID5 - Shoe Colors
    ID6/SubID 5 - Red .......and so on.
    I now try to display all the ID and SubID records in the same
    order as the input;
    SELECT *
    FROM test
    WHERE ID = SubID
    This gives no result. Any idea how to display this?
    Kind regards,
    Bjørn.

    I'm trying to figure out how you made that table. If ID is an
    autonumber,
    how is the data under one record something like a title and
    under another
    one, a number? That isn't possible.
    What exactly are you trying to accomplish?
    Nancy Gill
    Adobe Community Expert
    BLOG:
    http://www.dmxwishes.com/blog.asp
    Author: Dreamweaver 8 e-book for the DMX Zone
    Co-Author: Dreamweaver MX: Instant Troubleshooter (August,
    2003)
    Technical Editor: DMX 2004: The Complete Reference, DMX 2004:
    A Beginner's
    Guide, Mastering Macromedia Contribute
    Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP
    Web Development
    "btn" <[email protected]> wrote in message
    news:e9t94r$lcn$[email protected]..
    > Hi - using asp/vbscript/access
    >
    > I struggle with a small SQL issue and hope that someone
    can assist me;
    >
    > I have one db table, lets call it "test".
    > Coloumns are ID, SubID, Name
    > ID holds the uniqe ID and headline for each record (
    Name).
    > SubID holds the content linked to the corresponding ID.
    >
    > Something like this;
    >
    > ID1 - Shoe sizes
    > ID2 / SubID 1 - 40
    > ID3/ SubID 1 - 41
    > ID4/SubID 1 - 42
    > ID5 - Shoe Colors
    > ID6/SubID 5 - Red .......and so on.
    >
    > I now try to display all the ID and SubID records in the
    same order as the
    > input;
    >
    > SELECT *
    > FROM test
    > WHERE ID = SubID
    >
    > This gives no result. Any idea how to display this?
    >
    > Kind regards,
    >
    > Bj?rn.
    >

  • I need  abap oops help docu?

    i need abap oops help docu?

    Hi Karthikeyan,
    Chk this standard Programs.
    ABAP_OBJECTS_ENJOY_0 Template for Solutions of ABAP Object Enjoy Course
    ABAP_OBJECTS_ENJOY_1 Model Solution 1: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_2 Model Solution 2: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_3 Model Solution 3: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_4 Model Solution 4: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_5 Model Solution 5: ABAP Objects Enjoy Course
    DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
    DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
    DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
    DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
    DEMO_ABAP_OBJECTS_INTERFACES Demonstration of Interfaces in ABAP Objects
    DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
    links for OO ABAP.
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com.
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    some more materials.
    Go through the following Documents Links & Materials for ABAP Objects
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/sap.user72/blog/2005/05/10/a-small-tip-for-the-beginners-in-oo-abap
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    /people/thomas.jung3/blog/2005/09/08/oo-abap-dynpro-programming
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    OO ABAP is nothing but a class-method apprach to write ABAP codes and define them : below are few of the informations which will be of help for a newbie :
    Types of attributes and the basic concepts :
    Public attributes
    Private attributes
    Instance attributes
    Static attributes
    Public methods
    Private methods
    Constructor method
    Static constructor
    Protected components
    Polymorphism
    Public attributes
    Public attributes are defined in the PUBLIC section and can be viewed and changed from outside the class. There is direct access to public attributes. As a general rule, as few public attributes should be defined as possible.
    PUBLIC SECTION.
    DATA: Counter type i.
    Private attributes
    Private attributes are defined in the PRIVATE section. The can only be viewes and changed from within the class. There is no direct access from outside the class.
    PRIVATE SECTION.
    DATA: name(25) TYPE c,
    planetype LIKE saplane-planetyp,
    Instance attributes
    There exist one instance attribute for each instance of the class, thus they exist seperately for each object. Instance attributes are declared with the DATA keyword.
    Static attributes
    Static attributes exist only once for each class. The data are the same for all instances of the class, and can be used e.g. for instance counters. Static attributes are defined with the keyword CLASS-DATA.
    PRIVATE SECTION.
    CLASS-DATA: counter type i,
    Public methods
    Can called from outside the class
    PUBLIC SECTION.
    METHODS: set_attributes IMPORTING p_name(25) TYPE c,
    p_planetype LIKE saplane-planetyp,
    Private methods
    Can only be called from inside the class. They are placed in the PRIVATE section of the class.
    Constructor method
    Implicitly, each class has an instance constructor method with the reserved name constructor and a static constructor method with the reserved name class_constructor.
    The instance constructor is executed each time you create an object (instance) with the CREATE OBJECT statement, while the class constructor is executed exactly once before you first access a class.
    The constructors are always present. However, to implement a constructor you must declare it explicitly with the METHODS or CLASS-METHODS statements. An instance constructor can have IMPORTING parameters and exceptions. You must pass all non-optional parameters when creating an object. Static constructors have no parameters.
    Static constructor
    The static constructor is always called CLASS_CONSTRUCTER, and is called autmatically before the clas is first accessed, that is before any of the following actions are executed:
    Creating an instance using CREATE_OBJECT
    Adressing a static attribute using <classname>-><attrbute>
    Calling a ststic attribute using CALL METHOD
    Registering a static event handler
    Registering an evetm handler method for a static event
    The static constructor cannot be called explicitly.
    Protected components
    When we are talking subclassing and enheritance there is one more component than Public and Private, the Protected component. Protected components can be used by the superclass and all of the subclasses. Note that Subclasses cannot access Private components.
    Polymorphism
    Polymorphism: When the same method is implemented differently in different classes. This can be done using enheritance, by redefining a method from the superclass in subclasses and implement it differently.
    Reward points if helpful.
    Regards,
    Harini.S

  • Hard Drive Failure on HP DV 6000 Pavilion laptop Windows-XP​sp3 OS - Need Data Recovery Help

    Hard Drive Failure on HP DV 6000 Pavilion laptop - Need Data Recovery Help
    HP Pavilion DV 6108 NR, RG365UA, purchased in late 2006 at Best Buy, with Windows XP, upgraded to Service Pack 3. It has a Fujitsu hard disk, 60 gigabyte, partitioned into C: and a Recovery D:.
    Windows tries to boot up, but goes to blue screen with the message: "Unmountable Boot Volume" for one second, then just keeps recycling until I force a shutdown.
    BIOS Phoenix, hard drive test result: " #1-08 Fail "
    I ran a disk analysis/recovery program on the Cdrive and it seemed to show the directory structure intact, and it was able to recover some files. I was using the free one from Seagate (which only recovers small files). The second pass didn't run so well, and during the third run the program said I should not proceed further, and I should contact a professional disk recovery company.
    However, the D drive seems to be intact, so, I wonder if the disk is corrupted or just some aspect of the logical C drive is bad.
    How can I get the D: to run the recovery software on it? The recovery disks, made by Best Buy, only proceed to the R / F / Q option screen, and when I press R, I get a blue screen every time.
    Tapping the F10 key during startup gets me nowhere. Ditto the F11 key.
    I dont care about the hard disk; it is the data (files, docs, images, etc)  that I want.
    I contacted HP to order recovery disks but they are no longer available for my computer.
    Any suggestions would be greatly appreciated!
    Jon
    This question was solved.
    View Solution.

    Update...
    I found a website that offers the following:
    http://www.computersurgeons.com/p-13442-recovery-k​it-435422-001-for-hp-model-number-dv6108nr.aspx
    Recovery Kit 435422-001 For HP Model Number dv6108nr
    Price: $27.00
    Recovery Kit Set (An Entire Image of the Computer hard drive when the computer was new)
    But I wonder how useful it would be. Early XP , no doubt. And if my hard disk problem is a mechanical fault, would any recovery disk even work? The disks made by Best Buy when I bought mine new in 2006 don't do anything more than go to the R /F/ Q screen and then goes to a blue screen when I press R (to recover the OS and apps and data files). And, as I wrote, it is the data that I want, not the disk drive.

  • PIVOT sql help

    Hi again
    I need some PIVOT sql help
    In this query:
    SELECT
    SUM([RATES]) as RATES
    ,SUM([CONVERSION])as CONVERSION
    FROM REPORTING
    outputs
    RATES CONVERSION
    23 234
    How would change this query to display a table like:
    Name Amount
    RATES 23
    CONVERSION 234
    Keep up the good work !

    nikos101 wrote:
    > How would change this query to display a table like:
    Do you *HAVE* to change the query... you could just display
    it in the
    desired format if that it the ultimate and only goal.
    <table>
    <tr>
    <td>name</td>
    <td>amount</td>
    </tr>
    <cfoutput query="sumQry">
    <tr><td>Rates</td><td>#rates#</td></tr>
    <tr><td>Conversion</td><td>#conversion#</td></tr>
    </cfoutput>
    </table>

  • Need pl/sql stmnts. for this simple logic

    Hi,
    I need PL/SQL program for this simple logic i am doing mistake somewhere unbale to trace
    out ..
    select * from GSR03_PO_DTL;
    PO_NUM
    L53177000 -- > no changes reqd (only one entry with new format)
    L00041677 --> to be updated to L41677000(only one entry with OLD format)
    L43677000 -- > no change reqd (exists one row with new format and old format like below)
    L00043677 -- > to be deleted this is old format (and new format like above already exists)
    EX:
    L00012345 --- old format
    L12345000 --- new format
    Hope question is clear. I written the following program.
    update is working fine but delete is not working.
    Please help.
    Thanks in Advance
    Devender
    declare
    Cursor c_test is
    (select po_num from GSR03_PO_DTL);
    BEGIN
    FOR r_test in c_Test
    LOOP
    dbms_output.put_line (r_test.po_num);
    IF ('L'||substr(r_test.po_num,5,5)) = ('L'||substr(r_test.po_num,2,5)) then
         dbms_output.put_line ('delete stmnt');
    END IF;     
    EXIT WHEN c_test%NOTFOUND;
    END LOOP;
    FOR r_test in c_Test
    LOOP
    IF r_test.po_num like 'L000%' then
    IF ('L'||substr(r_test.po_num,5,5)) is not NULL then
         update GSR03_PO_DTL set PO_NUM = 'L'||substr(po_num,5,5)||'000'
         where po_num like 'L000%' ;
         dbms_output.put_line ('update stmnt');
    END IF;     
    END IF;
    END LOOP;
    END;
    *********************

    No need for PL/SQL, man.
    SQL> SELECT po_no FROM po1
      2  /
    PO_NO
    L53177000
    L00041677
    L43677000
    L00043677
    SQL> UPDATE po1 y
      2  SET    y.po_no = 'L'||substr(y.po_no,5,5)||'000'
      3  WHERE  y.po_no LIKE 'L000%'
      4  AND    NOT EXISTS ( SELECT null FROM po1 x
      5                      WHERE x.po_no =  'L'||substr(y.po_no,5,5)||'000')
      6  /
    1 row updated.
    SQL> DELETE FROM po1 y
      2  WHERE  y.po_no LIKE 'L000%'
      3  AND    EXISTS ( SELECT null FROM po1 x
      4                  WHERE x.po_no =  'L'||substr(y.po_no,5,5)||'000')
      5  /
    1 row deleted.
    SQL> SELECT po_no FROM po1
      2  /
    PO_NO
    L53177000
    L41677000
    L43677000
    SQL> Cheers, APC

  • SQL Help for Date Range display

    Gurus,
    I have a sql statement like
    select MIN(HIREDATE), MAX(HIREDATE) FROM EMP WHERE DEPTNO = 30My output looks like
    MIN(HIREDATE)     MAX(HIREDATE)
    12/30/1998        12/30/2001Based on the values of MIN(HIREDATE) , MAX(HIREDATE) values
    I need a SQL to generate the output like
    12/30/1998
    1/30/1999
    2/28/1999
    until Max(HIREDATE) value
    In Feb we dont have 30th day, In that case take the last day of the month.
    Thanks for great help
    C 007

    With 10g.
    Regards Salim.WITH t AS
         (SELECT min(hiredate) min_hiredate,
                 max(hiredate) max_hiredate
            FROM emp_test
            where deptno=30)
    SELECT min_hiredate dt
      FROM t
    model
    dimension by ( 1 rn)
    measures(min_hiredate,months_between(max_hiredate,min_hiredate) diff )
    (min_hiredate[for rn from 1 to diff[1] increment  1]=add_months( min_hiredate[1],cv(rn)-1))
    order by rn
    SQL> WITH t AS
      2       (SELECT min(hiredate) min_hiredate,
      3               max(hiredate) max_hiredate
      4          FROM emp_test
      5          where deptno=30)
      6  SELECT min_hiredate dt
      7    FROM t
      8  model
      9  dimension by ( 1 rn)
    10  measures(min_hiredate,months_between(max_hiredate,min_hiredate) diff )
    11  (min_hiredate[for rn from 1 to diff[1] increment  1]=add_months( min_hiredate[1],cv(rn)-1))
    12  order by rn
    13  /
    DT
    1998-12-30
    1999-01-30
    1999-02-28
    1999-03-30
    1999-04-30
    1999-05-30
    1999-06-30
    1999-07-30
    1999-08-30
    1999-09-30
    1999-10-30
    1999-11-30
    1999-12-30
    2000-01-30
    2000-02-29
    2000-03-30
    2000-04-30
    2000-05-30
    2000-06-30
    2000-07-30
    2000-08-30
    2000-09-30
    2000-10-30
    2000-11-30
    2000-12-30
    2001-01-30
    2001-02-28
    2001-03-30
    2001-04-30
    2001-05-30
    2001-06-30
    2001-07-30
    2001-08-30
    2001-09-30
    2001-10-30
    2001-11-30
    SQL> 

  • Dynamic SQL help!

    I'm trying to build a update statement with different operator which setup from a table and passed. Not sure how to build it. Please help
    PROCEDURE my_update
      p_id            IN NUMBER,
      p_var1          IN NUMBER,
      my_value        IN VARCHAR2,
      my_operator     IN VARCHAR2,
      x_return_status OUT VARCHAR2,
      x_errors        OUT VARCHAR2
    ) IS
      l_dynamic_string VARCHAR2(4000);
    BEGIN
    l_dynamic_string := table_b.col2 ||
                        rec.my_operator  /* value as: "=" OR "LIKE" */ ||
                        my_value /* VALUE AS "2233"  OR "900%" */
      UPDATE table_b
         SET col1 = ''
       WHERE id = p_id
         AND l_dynamic_string
         AND id = (SELECT table_a.id
                     FROM table_a
                    WHERE id = p_id
                      AND col_a = p_var1);
    EXCEPTION
      WHEN OTHERS THEN
        NULL;
    END my_update;

    Hi,
    What you posted can probably be done without dynamic SQL. If the expression after LIKE does not conatin a wild-card, then LIKE behaves just like =. You can probably arrange things so that the query always uses LIKE.
    If you need dynamic SQL, then use EXECUTE IMMEDIATE to perform it.
    I think you want something like this:
    PROCEDURE my_update
      p_id            IN NUMBER,
      p_var1          IN NUMBER,
      my_value        IN VARCHAR2,
      my_operator     IN VARCHAR2,
      x_return_status OUT VARCHAR2,
      x_errors        OUT VARCHAR2
    ) IS
      l_dynamic_string VARCHAR2 (4000);
      l_update_txt        VARCHAR2 (4000);
    BEGIN
        l_dynamic_string := table_b.col2 || ' '     -- If my_operator is LIKE you'll need a space here
                                        || my_operator               /* value as: "=" OR "LIKE" */
                             || Q'< '>'
                             || my_value            /* VALUE AS "2233"  OR "900%" */
                             || Q'<' >'
        l_update_txt := 'UPDATE table_b'
                    || '   SET col1 = NULL'
                  || ' WHERE id = p_id'
                    || '   AND ' || l_dynamic_string
                    || '   AND id = (SELECT table_a.id'
                     || '                     FROM table_a'
                     || '             WHERE id = p_id
                     || '               AND col_a = p_var1)';
        dbms_output.put_line (l_update_txt || ' = l_update_txt in my_update');
    --  EXECUTE IMMEDIATE  l_update_txt;
    --     No EXCEPTION hider
    END my_update;While writing dynamic SQL, it's a good idea to display the dynamic text. I used put_line to do that. Remember to comment out (or remove) the display code when testing is finished.
    Notice that the EXECUTE IMMEDIATE command is commented out. Only after you've tested some, and you think l_update_txt is correct, should you un-commnet that line.
    Never say "EXCEPTION WHEN OTHERS THEN NULL;"
    Error messages help you, especially duting development when you're likely to have lots of coding errors.
    If you really need to keep the program running after encountering certain errors, then it's okay to have an EXCEPTION block, but your use of either "WHEN OTHERS" or "THEN NULL" should be very limited, and you should not use both of them together.

  • Need a query help

    hii
    i need a query help
    i have two tables
    the 1st table will look like this
    associate id weekid no.of. hours
    4000 810 40
    4000 820 30
    4000 830 60
    4000 840 70
    2nd table will look like this
    associate id weekid no.of.hours
    4000 810 40
    4000 820 70
    4000 830 130
    4000 840 200
    so when i subtract the last two records frm each other in the second table the value should be equal to the no.of.hours in the first table.. for example
    the query shud consider the last record and one before the last record and the difference between two records shud be equal to the value in the 1st table
    for example
    consider week id 830 and 840
    in second table 830=130
    840=200
    when u subtraced both values the difference shud be equal to value in the 1st table for tht week id
    1 ---->>>> 840 - 830
    =200 - 130
    =70
    in first table 840 has 70 hrs
    like this it shud check with all records and it shud return only the records which are not equal
    regards
    srikanth

    This..?
    sql>select * from t1;
    A_ID W_ID HRS
    4000  810  40 
    4000  820  30 
    4000  830  60 
    4000  840  70 
    4000  850  80 
    sql>select * from t2;
    A_ID W_ID HRS 
    4000  810  40 
    4000  820  70 
    4000  830  130 
    4000  840  200 
    4000  850  260 
    sql>
    select a_id,w_id,hrs,sum_hrs
    from(
    select t1.a_id a_id,t1.w_id w_id,t1.hrs hrs,t2.hrs sum_hrs,
           t2.hrs - nvl(lag(t2.hrs)  over(order by t1.w_id),0) diff
    from t1,t2
    where t1.w_id = t2.w_id)
    where diff != hrs;
    A_ID W_ID HRS SUM_HRS 
    4000  850  80  260                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Small SQL problem

    Hello,
    I have a small SQL problem...
    I am designing an online bank using servlets for a university project and it allows customers to view their statements. They select which of their account numbers they want to view the statement for and the start and end date of the statement.
    The problem lies with the dates. Here is the SQL:
    SELECT date, details, amount, balance
    FROM HISTORY
    WHERE bankaccnumber=13494925 And date>=1/1/01 And date<=31/1/01;
    All of the books I have looked at show dates in '1/1/01' format but whenever I try it this way I get a 'Data type mismatch in criteria expression' error (the 'date' field in the Database IS a Date type).
    Although, whenever I run the query in Access and prompt the user to enter the start and end date, it works fine.
    I have spoken to a few people and no-one seems to know why it is not working.
    Any ideas???
    Thanks

    If your database is MS Access and you don't expect to switch to something else, then write this:
    SELECT date, details, amount, balance
    FROM HISTORY
    WHERE bankaccnumber=13494925 And [date]>=#1/1/01# And [date]<=#1/31/01#
    Note that you MUST format your dates as MM/DD/YY and not as DD/MM/YY, that's an Access rule, and that you will probably have to "quote" your column name "date", which I think is a reserved word in SQL and hence a bad choice for column name.
    Personally I always use PreparedStatements. That way my SQL would look like this:
    SELECT date, details, amount, balance
    FROM HISTORY
    WHERE bankaccnumber=13494925 And date>=? And date<=?
    and I would use the setDate() method to fill in the parameters. Since this method uses a Date as a parameter, I don't need to fight with date formats, the JDBC driver handles that for me.

  • I need abap object help file.helpful link

    i need abap object help file.helpful link

    Hi
    Go through the below links,
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    OO ABAP links:
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    check all the below links
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    Check these links.
    http://www.henrikfrank.dk/abapuk.html
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc

  • I need a little help

    hi i need a little help making a java applet rpg with log-in, chat, etc. and i dont really know to much about it and dont understand applet programming too much. If anyone could help, it would be appreciated. Also, since i am fairly decent at making/improving websites, if you help me i could make a website for you or improve one you already have. You can email me if you want to help at "[email protected]"

    Don't just give up. Like I said, start small.
    I've never heard of any pre-made RPG java classes.
    Why don't you poke around on SourceForge or some java-centric project site or one of the java gaming sites. Maybe someone has written all these libraries already, although you may have trouble using these classes if you're not familiar with programming in general and java in particular. Or do a Google search.
    But using a specialized API is a lot easier if you know how to use the general API (i.e., j2se).
    Another option of course is not to use java at all. Many commercial games come with an editor; you may find it easier to get one of those and do a mod.

  • I have iphone 4 screen goes small pleae help

    i have iphone 4 m y screen resolution goes small pls help i cant do anything...

    We need a clear, yet descriptive picture of what you are exeriencing. What is is you are seeting, and then what happends when the "problem" appears for you?
    GB

Maybe you are looking for

  • What does it mean: "Calendar was created by Mail"?

    I upgraded to the latest version of iCal.  Now, when I try to input a new event, I get the message: " Calendar was created by Mail.  You can not add an event to a Mail calendar.   Does any one know what this means and what I need to do to change it s

  • To get first date and end date after entering any month and year

    Hi, I need to to get first date and end date of a month and year in yyyyMMdd format. I am reading month and year from a properties file. But I don't know how to get the first date and End date in given format. The properties file gives me just text.

  • Call  RFC from ECC and display the values in  AET

    Hi ALL, I had an RFC in ECC ( Z_CRM_SPEC_DATA) this should be called into my AET Fields in getter method. In getter method of tat AET field what code should i write? Plz help me on this.

  • I updated my iPod Touch 4G...

    I updated my iPod Touch 4G, and it automatically restored itself! Now I can't find any of my apps on it. Can anyone please help me? (I bought a $15.00 app, so I don't want to buy it again).

  • Creative Suite trial stuck in "extracting"

    Trying to download free trial of craetive suite5.5 and it is stuckin  extracting. tried again to download indesign and same thing. I am putting it in the applications file and it creates a folder for it and just the dmg file is in there. when verifyi