Strange problem with SQL-Statement

Hi guys,
i encountered a strange problem trying to execute a statement
like this:
Insert Into Data Set Text = 'Exception-Type: {0} Message: {1}';
I'm using createStatement and executeUpdate.
But the message stored looks like:
Exception-Type: 0{} Message: 1{}
I'm using MySQL 3.23. if I use ODBC everthing is o.k.!?
Any suggestions
Thanks

I found a solution,
i've thought it through once again. the sql-parsing
mechanism seemed to be the right direction.
i guess the odbc mysql implementation does a sql-statement
conversion, so the string is stored correctly into the
database. the jdbc-implementation doesn't.
if i replace { with \{ it works. the backlash can be used
to masquerade some characters in mysql.
my application is database independent (or it should be)
so i wonder if this works with oracle , db2 etc.
mike

Similar Messages

  • Strange problem with SQL query in toad.

    Guys,
    My colleague is up with a strange problem with an SQL query that if it is run in toad encounters the "ORA-03113: end-of-file on communication channel" problem,but if run in SQL plus executes just fine.
    Do anyone have thoughts about this strange error in toad?
    Thanks!!!!
    Regards,
    Bhagat

    Not sure what version of TOAD you have but it may have shipped with SQLMonitor which montiors SQL sent from Windows apps . Navigation should be similar to;
    Start~Programs~Quest Software~TOAD for Oracle~Tools~SQLMonitor
    or
    C:\Program Files\Quest Software\Toad for Oracle\SQLMonitor.exe
    To use it, start TOAD and connect, start SQLMonitor and click the checkbox for TOAD.exe, then execute the query. SQLMonitor will show you the actual query that TOAD sent to the client. It may be exactly what you sent or it may contain some extras.

  • Problem with sql statement

    hi
    i have a strange problem....when i run the following code with the 'if' statement commented out then it works fine. but when i have to search a particular name, say roy , then i include that if statement. but now it gives an error like no such data found.
    if the return typ of result.getString(2) is a string type then i wonder what is the problem. i enclose the code below.
    import java.sql.*;
    import java.io.*;
    public class checkDoc
         public static void main(String args[])
              String name;
              ResultSet result;
              try
                   name= "roy";
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection con;
                   con = DriverManager.getConnection("jdbc:odbc:MyDataSource","","");
                   Statement stat = con.createStatement();
                   result = stat.executeQuery("Select * from Details1");
                   while (result.next())
    /* problem here*/
    /*     if(result.getString(2).equals(name))
         */               System.out.println(result.getString(2));
              catch(Exception e)
                   System.out.println("Error"+e);

    thanks alot for that help...but now there is another silly problem!..
    i following is perhaps the simplest code possible for insering data into an ACCESS database.(simplest possible with just one column by the name Doc_name and table name is docdetails)...but it gives the error...
    "java.sql.SQLException:syntax error or in INSERT INTO statement"
    someone plz help!
    import java.sql.*;
    public class checkDoc4
         public static void main(String args[])
              ResultSet rs;
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection con;
                   con = DriverManager.getConnection("jdbc:odbc:MyDataSource2","","");
    Statement stat = con.createStatement();
                        stat.executeUpdate("INSERT INTO docdetails" +
         "VALUES ('ankur')");          
              catch(Exception e)
                   System.out.println("Error"+e);

  • Strage Performance Problems with SQL Statements....

    Hi,
    I have realized a strange performance collapse while changing simple things in SQL Statements...
    I have build a simple Statement:
    SELECT
    a.AAA,
    a.BBB,
    a.CCC,
    b.AAA
    from
    TABLE_A a,
    TABLE_B b,
    TABLE_C c
    where
    a.XXX=b.XXX
    and c.XXX = a.XXX
    and c.yyy = 'SOMETHING'
    Its very fast, even with complex XSL Transformations...
    After Putting a GROUP BY or DISTINCT into the statement (to surpress Dataset "Clones") it tooks around 100 times more Time then before....
    I have tested the statement in a SQLPlus, it was as fast as before, but in the XMLPublisher it tooks much longer.....
    Have you realizesd this Problem before?
    Greetings...

    PROBLEM SOLVED !
    It has to be 8.1.6 across the whole environment.
    null

  • Problem with SQL Statement for Result Filtering

    Dear Visual Composer Experts,
    Here is another Question from me: I have a SQL Query that is working as the data service
    Select AB.AgingBandID, AB.AgingBand,
    Sum(Case when priority='Emergency' then '1' Else 0 End) as [Emergency],
    Sum(Case when priority='Ugent' then '1' Else 0 End) as Ugent,
    Sum(Case when priority='High' then '1' Else 0 End) as High,
    Sum(Case when priority='Medium' then '1' Else 0 End) as Medium,
    Sum(Case when priority='Low' then '1' Else 0 End) as Low
    from DimAgingBand AB left outer join
    (Select AgingBandID , priority , yeardesc
    from vNotifications where YearDesc = (select year(getdate())-1)) as vN
    on AB.AgingBandID=vN.AgingBandID
    where AB.AgingBandID<>'1'  
    Group by  AB.AgingBandID, AB.AgingBand
    Order by AB.AgingBandID
    That would return me a table as in the following:
         Agingband     E     U     H     M     L
         < 1week     0     0     0     0     1
         1 - 2 weeks     0     0     0     0     0
         2 - 4weeks     0     0     0     0     1
    > 1month     8     2     1     1     6
    Now that I would like to add some parameters to filter the result, so I modify the query and put it in the SQL Statement input port of the same data service. The query is like this:
         "Select AB.AgingBandID, AB.AgingBand,Sum(Case when priority='Emergency' then '1' Else 0 End) as [Emergency],Sum(Case when priority='Ugent' then '1' Else 0 End) as Ugent,Sum(Case when priority='High' then '1' Else 0 End) as High,Sum(Case when priority='Medium' then '1' Else 0 End) as Medium,Sum(Case when priority='Low' then '1' Else 0 End) as Low from DimAgingBand AB left outer join (Select AgingBandID , priority , yeardesc from vNotifications where YearDesc like '2009%' and Branch like '" & if(STORE@selectedBranch=='ALL', '%', STORE@selectedBranch) & "' and MainWorkCentre like '%') as vN on AB.AgingBandID=vN.AgingBandID where AB.AgingBandID<>'1' Group by AB.AgingBandID, AB.AgingBand Order by AB.AgingBandID"
    However this input port query keeps giving me error as NullPointerException. I have actually specified a condition where the query will run if only STORE@selectedBranch != u2018u2019.
    I have other filtering queries working but they are not as complicated query as this one. Could it be possible that query in the input port cannot handle left outer join?
    Could it be anything else?
    Help is very much appreciated.
    Thanks & Regard,
    Sarah

    Hi,
    Thank you very much for your replys. I've tested if the dynamic value of the condition is integer, it's OK
    But if the ClassID type is not integer, it's string, I write  a SQL Statement like:
    "Select DBADMIN.Class.ClassName from DBADMIN.Class where DBADMIN.Class.ClassID = '1' "
    or with dynamic condition:
    "Select DBADMIN.Class.ClassName from DBADMIN.Class where DBADMIN.Class.ClassID = '"&@ClassID&"'"
    or I write the SQL Statement for insert/update/delete data,
    I always have errors.
    I've tested if the dynamic value of the condition is integer, it's OK
    Do you know this problem ?
    Thank you very much & kindly regards,
    Tweety

  • Problem with sql statement after migration

    Hi, recently I copied a production database X to a remote location, to serve as a test upgrade database. Original is 32 bit and test database is 64 bit. After migration it turned out that one sql statement consumed much more CPU during EXECUTE phase than on production database. Explain plans are the same. Why CPU is different? How can I trace the problem?
    ORIGINAL SERVER TKPROF OUTPUT:
    call count cpu elapsed disk query current rows
    Parse 1 0.12 0.33 0 0 2 0
    Execute 1 542.60 2165.29 2 6 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 542.73 2165.62 2 6 2 0
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 66 (SPB)
    Rows     Row Source Operation
          0  SORT UNIQUE (cr=6 pr=2 pw=0 time=719909655 us)
          0   FILTER  (cr=6 pr=2 pw=0 time=719909615 us)
          2    NESTED LOOPS  (cr=0 pr=0 pw=0 time=719895787 us)
          2     HASH JOIN  (cr=0 pr=0 pw=0 time=719881575 us)
          2      NESTED LOOPS  (cr=0 pr=0 pw=0 time=1210563833 us)
          2       NESTED LOOPS  (cr=0 pr=0 pw=0 time=1210549798 us)
          2        NESTED LOOPS  (cr=0 pr=0 pw=0 time=1210519159 us)
    330261         REMOTE  TWFLPROCESSINSTANCES (cr=0 pr=0 pw=0 time=29176788 us)
          2         REMOTE  TAMCONTRACTEDITEMD (cr=0 pr=0 pw=0 time=1177866001 us)
          2        REMOTE  TAMPROPVALUES (cr=0 pr=0 pw=0 time=30580 us)
          2       REMOTE  TREPVALUELISTITEMS (cr=0 pr=0 pw=0 time=13973 us)
    24542745      REMOTE  TAMCONTRACTEDITEMD (cr=0 pr=0 pw=0 time=638116004 us)
          2     REMOTE  TWFLPROCESSINSTANCES (cr=0 pr=0 pw=0 time=14154 us)
          2    INDEX RANGE SCAN IDX_PROCES_ID (cr=6 pr=2 pw=0 time=13706 us)(object id 546934)
    Rows     Execution Plan
          0  INSERT STATEMENT   MODE: ALL_ROWS
          0   SORT (UNIQUE)
          0    FILTER
          2     NESTED LOOPS
          2      HASH JOIN
          2       NESTED LOOPS
          2        NESTED LOOPS
          2         NESTED LOOPS
    330261          REMOTE OF 'TWFLPROCESSINSTANCES' (REMOTE)
                         [T6STDBY.WR]
                        SELECT /*+ OPAQUE_TRANSFORM */ "ID","STATUS","STARTDATE"
                        FROM "DIALOG6"."TWFLPROCESSINSTANCES" "PI" WHERE
                          "STATUS"<>'A' AND "STATUS"<>'N' AND "STARTDATE">=:1-30
          2          REMOTE OF 'TAMCONTRACTEDITEMD' (REMOTE)
                         [T6STDBY.WR]
                        SELECT /*+ OPAQUE_TRANSFORM */ "CITEM_ID","ROOTCITEM_ID",
                        "PRODUCT_ID","CONTRACT_ID" FROM
                        "DIALOG6"."TAMCONTRACTEDITEMD" "CI" WHERE "PRODUCT_ID"=
                          934 AND "CONTRACT_ID"=:1
          2         REMOTE OF 'TAMPROPVALUES' (REMOTE) [T6STDBY.WR]
                       SELECT /*+ OPAQUE_TRANSFORM */ "PROPERTY_ID",
                       "VALUEOBJECT_ID","CONTRACTEDITEM_ID","DTO","ISVALID"
                       FROM "DIALOG6"."TAMPROPVALUES" "TV" WHERE "DTO" IS NULL
                       AND "ISVALID"='Y' AND "CONTRACTEDITEM_ID"=:1 AND
                         "PROPERTY_ID"=930326
          2        REMOTE OF 'TREPVALUELISTITEMS' (REMOTE) [T6STDBY.WR]
                      SELECT /*+ OPAQUE_TRANSFORM */ "ID","NAME" FROM
                        "DIALOG6"."TREPVALUELISTITEMS" "TVL" WHERE "ID"=:1
    24542745       REMOTE OF 'TAMCONTRACTEDITEMD' (REMOTE) [T6STDBY.WR]
                     SELECT /*+ OPAQUE_TRANSFORM */ "CITEM_ID","CONTRACT_ID" FROM
                       "DIALOG6"."TAMCONTRACTEDITEMD" "CINAD"
          2      REMOTE OF 'TWFLPROCESSINSTANCES' (REMOTE) [T6STDBY.WR]
                    SELECT /*+ OPAQUE_TRANSFORM */ "ID" FROM
                    "DIALOG6"."TWFLPROCESSINSTANCES" "SYS_ALIAS_1" WHERE "ID"=
                      :1
          2     INDEX   MODE: ANALYZED (RANGE SCAN) OF 'IDX_PROCES_ID'
                    (INDEX)
    REMOTE SERVER TKPROF OUTPUT:
    call count cpu elapsed disk query current rows
    Parse 1 0.15 0.15 0 0 2 0
    Execute      1   1210.69    3831.70          0          6          0           0
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 1210.85 3831.85 0 6 2 0
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 66 (SPB)
    Rows     Row Source Operation
          0  SORT UNIQUE (cr=6 pr=0 pw=0 time=681448432 us)
          0   FILTER  (cr=6 pr=0 pw=0 time=681448397 us)
          2    NESTED LOOPS  (cr=0 pr=0 pw=0 time=681448144 us)
          2     HASH JOIN  (cr=0 pr=0 pw=0 time=681443808 us)
          2      NESTED LOOPS  (cr=0 pr=0 pw=0 time=168646003 us)
          2       NESTED LOOPS  (cr=0 pr=0 pw=0 time=168636029 us)
          2        NESTED LOOPS  (cr=0 pr=0 pw=0 time=168580989 us)
    327667         REMOTE  TWFLPROCESSINSTANCES (cr=0 pr=0 pw=0 time=9177863 us)
          2         REMOTE  TAMCONTRACTEDITEMD (cr=0 pr=0 pw=0 time=158011360 us)
          2        REMOTE  TAMPROPVALUES (cr=0 pr=0 pw=0 time=55007 us)
          2       REMOTE  TREPVALUELISTITEMS (cr=0 pr=0 pw=0 time=9947 us)
    24542745      REMOTE  TAMCONTRACTEDITEMD (cr=0 pr=0 pw=0 time=3509657414 us)
          2     REMOTE  TWFLPROCESSINSTANCES (cr=0 pr=0 pw=0 time=4309 us)
          2    INDEX RANGE SCAN IDX_PROCES_ID (cr=6 pr=0 pw=0 time=160 us)(object id 552075)
    Rows     Execution Plan
          0  INSERT STATEMENT   MODE: ALL_ROWS
          0   SORT (UNIQUE)
          0    FILTER
          2     NESTED LOOPS
          2      HASH JOIN
          2       NESTED LOOPS
          2        NESTED LOOPS
          2         NESTED LOOPS
    327667          REMOTE OF 'TWFLPROCESSINSTANCES' (REMOTE)
                         [T6STDBY.WR]
                        SELECT /*+ OPAQUE_TRANSFORM */ "ID","STATUS","STARTDATE"
                        FROM "DIALOG6"."TWFLPROCESSINSTANCES" "PI" WHERE
                          "STATUS"<>'A' AND "STATUS"<>'N' AND "STARTDATE">=:1-30
          2          REMOTE OF 'TAMCONTRACTEDITEMD' (REMOTE)
                         [T6STDBY.WR]
                        SELECT /*+ OPAQUE_TRANSFORM */ "CITEM_ID","ROOTCITEM_ID",
                        "PRODUCT_ID","CONTRACT_ID" FROM
                        "DIALOG6"."TAMCONTRACTEDITEMD" "CI" WHERE "PRODUCT_ID"=
                          934 AND "CONTRACT_ID"=:1
          2         REMOTE OF 'TAMPROPVALUES' (REMOTE) [T6STDBY.WR]
                       SELECT /*+ OPAQUE_TRANSFORM */ "PROPERTY_ID",
                       "VALUEOBJECT_ID","CONTRACTEDITEM_ID","DTO","ISVALID"
                     FROM "DIALOG6"."TAMPROPVALUES" "TV" WHERE "DTO" IS NULL
                       AND "ISVALID"='Y' AND "CONTRACTEDITEM_ID"=:1 AND
                         "PROPERTY_ID"=930326
          2        REMOTE OF 'TREPVALUELISTITEMS' (REMOTE) [T6STDBY.WR]
                      SELECT /*+ OPAQUE_TRANSFORM */ "ID","NAME" FROM
                        "DIALOG6"."TREPVALUELISTITEMS" "TVL" WHERE "ID"=:1
    24542745       REMOTE OF 'TAMCONTRACTEDITEMD' (REMOTE) [T6STDBY.WR]
                     SELECT /*+ OPAQUE_TRANSFORM */ "CITEM_ID","CONTRACT_ID" FROM
                       "DIALOG6"."TAMCONTRACTEDITEMD" "CINAD"
          2      REMOTE OF 'TWFLPROCESSINSTANCES' (REMOTE) [T6STDBY.WR]
                    SELECT /*+ OPAQUE_TRANSFORM */ "ID" FROM
                    "DIALOG6"."TWFLPROCESSINSTANCES" "SYS_ALIAS_1" WHERE "ID"=
                      :1
          2     INDEX   MODE: ANALYZED (RANGE SCAN) OF 'IDX_PROCES_ID'
                    (INDEX)Edited by: Przemek P on 2012-01-27 07:40
    Edited by: Przemek P on 2012-01-27 07:50

    Could you please edit your post and use \ tags so the output is more user friendly?
    Type: \Your Code Here\It will display as:Your Code Here                                                                                                                                                                                                                                                                                                                                                                       

  • Problems with SQL statement ..Urgent Help required

    Hi
    I have a table with something like this
    ::: inidicates column seperation
    col1 ::: col2 ::: col3 ::: col4
    ab,abc,abvfg,fghy ::: x1 ::: y1 ::: z1
    ba,mkl,huji,kill ::: x2 ::: y2 ::: z2
    I want to get something like this :
    col1 ::: col2 ::: col3 ::: col4
    ab ::: x1 ::: y1 ::: z1
    abc ::: x1 ::: y1 ::: z1
    abvfg ::: x1 ::: y1 ::: z1
    fghy ::: x1 ::: y1 ::: z1
    and so on......
    Either a procedure or a single sql statement is fine..
    PS: the first column can have any number of words separated with comma (,)
    Please advise
    Thanks in advance

    create table kris (
    a varchar2(200),
    b varchar2(20),
    c varchar2(20),
    d varchar2(20));
    insert into kris values('ab,abc,abvfg,fghy', 'x1','y1','z1');
    insert into kris values('ba,mkl,huji,kill', 'x2','y2','z2');
    select substr(','||a||',', instr(','||a||',', ',', 1, rn) +1,
         instr(','||a||',', ',', 1, rn+1) - instr(','||a||',', ',', 1, rn) -1)
         v,b,c,d
    from (select length(a) - length(translate(a, '1,', '1')) +1 L,
         a, b, c, d from kris) t, (select rownum rn from cat) c
         where c.rn <= t.L
    order by a, rn;
    V B C D
    ab x1 y1 z1
    abc x1 y1 z1
    abvfg x1 y1 z1
    fghy x1 y1 z1
    ba x2 y2 z2
    mkl x2 y2 z2
    huji x2 y2 z2
    kill x2 y2 z2

  • Again the SUM and DISTINCT Problem (With SQL Statement)

    Here is the actual SQL,
    select
    NVL(l.pr_cust_prod,'zzzzz') A,
    NVL(l.pr_prod_code,'zzzzz') B,
    NVL(l.pr_lot_no,'zzzzz') C,
    NVL(l.db_waf_qty,'99999') lotQty,
    NVL(t.db_cust_po,'zzzzz') poNum,
    NVL(p.oe_po_line,'99999') poLineNum,
    i.db_shpmt_no invNum,
    from
    db_invoice i, db_line_lot l, db_inv_item t, db_prod_line p
    where
    l.db_shpmt_no like 'U388%'
    and i.db_invo_date > sysdate - 500
    and l.pr_run_type = 'PR'
    and l.db_shpmt_no = i.db_shpmt_no
    and l.db_shpmt_no = t.db_shpmt_no
    and l.db_item_no = t.db_item_no
    and p.db_ref_numa1 = t.db_tsmc_po
    and l.db_shpmt_no not in
    (select distinct db_shpmt_no from ftp_cust_ship
    where DB_MAST_ACCT='U388' and sys_name='SENT')
    and l.pr_prod_code like '%Z_'
    group by l.pr_lot_no, l.db_line_numb, l.pr_cust_prod, l.pr_prod_code,
    t.db_cust_po, i.db_delv_cod2, l.db_lot_desc, i.db_shpmt_no,
    p.oe_po_line
    order by lotNum
    the problem is that if I dont use SELECT DISTINCT at beginning
    the result is like
    F , LOTQTY , PONUM , POLINENUM
    DP8568.00,25 ,BVI10080 ,1
    DP8568.00,25 ,BVI10080 ,2
    DP8568.00,25 ,BVI10080 ,1
    DP8568.00,25 ,BVI10080 ,1
    DP8568.00,25 ,BVI10080 ,2
    DP8568.00,25 ,BVI10080 ,1
    DP8568.00,25 ,BVI10080 ,1
    DP8568.00,25 ,BVI10080 ,2 //pleae note the QTY and POLINENUM
    Then if Add SELECT DISTINCT, the result will be
    F ,LOTQTY , PONUM , POLINENUM
    DP8568.00,25 ,BVI10080,1
    DP8568.00,25 ,BVI10080,2
    but I change the NVL(l.db_waf_qty,'99999') lotQty, statement to NVL((SUM( l.db_waf_qty)),'99999') lotQty,
    this will give me the result
    F ,LOTQTY, PONUM , POLINENUM
    DP8568.00,75 , BVI10080 ,2
    DP8568.00,125 , BVI10080 ,1
    Which I excepted the result as
    F ,LOTQTY, PONUM , POLINENUM
    DP8568.00,25 , BVI10080 ,2
    DP8568.00,25 , BVI10080 ,1
    And Advise??
    Thanks a lot
    Jon

    based on the data set you given
    SQL>
    SQL> With t As
      2  (
      3  Select 'DP8568' c1 ,0.25 c2,'BVI10080' c3,1 c4 From dual Union All
      4  Select 'DP8568' ,0.25 ,'BVI10080' ,2           From dual Union All
      5  Select 'DP8568' ,0.25 ,'BVI10080' ,1           From dual Union All
      6  Select 'DP8568' ,0.25 ,'BVI10080' ,1           From dual Union All
      7  Select 'DP8568' ,0.25 ,'BVI10080' ,2           From dual Union All
      8  Select 'DP8568' ,0.25 ,'BVI10080' ,1           From dual Union All
      9  Select 'DP8568' ,0.25 ,'BVI10080' ,1           From dual Union All
    10  Select 'DP8568' ,0.25 ,'BVI10080' ,2           From dual
    11  )
    12  Select c1,
    13         sum(c2) lot_qty,
    14         c3,
    15         c4
    16  From
    17  (
    18    Select c1, --Sum(c2) over (Partition By c1,c4 Order By c4)
    19           row_number() over (Partition By c1,c4 Order By c4) rn,
    20           c2,
    21           c3,
    22           c4
    23    From t
    24  ) Where rn = 1
    25  Group By c1, c3, c4;
    C1        LOT_QTY C3               C4
    DP8568       0.25 BVI10080          2
    DP8568       0.25 BVI10080          1
    SQL>

  • Problems with SQL statement

    Here is the problem that I have .. I have a table that gets updated every 30 minutes.. and the columns are:
    Day Shift MDate
    The data is as follows:
    wed M 09012003
    wed N 09012003
    thu M 09022003
    thu N 09022003
    I want a SQL or PL/SQL that can help me in grabbing the distinct MDate where I have the instance of both M and N in the shift.
    For the above data, I want to get distinct MDates as 09012003
    09022003
    But here is the problem; at some point in time say in the evening.. the data looks like this
    wed M 09012003
    wed N 09012003
    thu M 09022003
    For the above data, I want to get distinct MDates as 09012003
    This is because "day" column with "thu" does not have both the instances of M and N in the "shift" column
    Any help in this regard is highly appreciated..
    Thanks in advance

    Use 'group by' and 'having':
    create table ttest(Day varchar2(3), Shift varchar2(1), MDate varchar(8));
    insert into ttest values('wed', 'M', '09012003');
    insert into ttest values('wed', 'N', '09012003');
    insert into ttest values('thu', 'M', '09022003');
    insert into ttest values('thu', 'N', '09022003');
    select distinct mdate from ttest group by mdate having count(1) > 1;
    MDATE
    09012003
    09022003
    delete from ttest;
    insert into ttest values('wed', 'M', '09012003');
    insert into ttest values('wed', 'N', '09012003');
    insert into ttest values('thu', 'M', '09022003');
    select distinct mdate from ttest group by mdate having count(1) > 1;
    MDATE
    09012003

  • Problem with SQL statement - Missing double quote in identifier

    Hi
    I am unable to run the following query in TOAD.
    SELECT A.* FROM (SELECT VC.CAMPAIGN_NUMBER," +
                   "VC.CAMPAIGN_TITLE,VC.CAMPAIGN_DESC,VC.START_DATE,VC.END_DATE,VC.CAMPAIGN_TYPE,VC.APPLICABILITY," +
                   "VC.CAMPAIGN_PRIORITY FROM VM_CAMPAIGN VC WHERE VC.APPLICABILITY = 'Y' and VC.COUNTRY_CODE = ? " +
                   "and VC.LANGUAGE_CODE = ? AND VC.CAMPAIGN_TYPE = ? AND SYSDATE BETWEEN VC.START_DATE AND " +
                   "VC.END_DATE AND NOT EXISTS (SELECT 'X' FROM VM_CAMPAIGN_VIN VCV WHERE (VCV.VIN = ? AND " +
                   "VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER))UNION SELECT VC.CAMPAIGN_NUMBER,VC.CAMPAIGN_TITLE," +
                   "VC.CAMPAIGN_DESC,VCV.START_DATE,VCV.END_DATE,VC.CAMPAIGN_TYPE,VC.APPLICABILITY,VC.CAMPAIGN_PRIORITY " +
                   "FROM VM_CAMPAIGN_VIN VCV ,VM_CAMPAIGN VC WHERE VCV.VIN = ? AND " +
                   "VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER AND VC.COUNTRY_CODE = ? AND VC.LANGUAGE_CODE = ? AND " +
                   "VC.CAMPAIGN_TYPE = ? AND SYSDATE BETWEEN VCV.START_DATE AND VCV.END_DATE AND SYSDATE BETWEEN " +
                   "VC.START_DATE AND VC.END_DATE) A ORDER BY A.CAMPAIGN_PRIORITY DESC, A.END_DATE
    I am getting "Missing double quote in identifier"
    I am not sure how to rectify this SQL code. Any suggestions are welcome
    thanks in advance

    maybe this will work.
    SELECT A.*
      FROM (SELECT VC.CAMPAIGN_NUMBER,
                   VC.CAMPAIGN_TITLE,
                   VC.CAMPAIGN_DESC,
                   VC.START_DATE,
                   VC.END_DATE,
                   VC.CAMPAIGN_TYPE,VC.APPLICABILITY,
                   VC.CAMPAIGN_PRIORITY
              FROM VM_CAMPAIGN VC
             WHERE VC.APPLICABILITY = 'Y'
               And VC.COUNTRY_CODE =  '&country_code'
               And VC.LANGUAGE_CODE = '&language_code'
               AND VC.CAMPAIGN_TYPE = '&campaign_type'
               AND SYSDATE BETWEEN VC.START_DATE AND VC.END_DATE
               AND NOT EXISTS (SELECT 'X'
                                 FROM VM_CAMPAIGN_VIN VCV
                                WHERE (VCV.VIN = &VIN AND
                                       VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER))
            UNION
            SELECT VC.CAMPAIGN_NUMBER,
                   VC.CAMPAIGN_TITLE,
                   VC.CAMPAIGN_DESC,
                   VCV.START_DATE,
                   VCV.END_DATE,
                   VC.CAMPAIGN_TYPE,
                   VC.APPLICABILITY,
                   VC.CAMPAIGN_PRIORITY
              FROM VM_CAMPAIGN_VIN VCV,
                   VM_CAMPAIGN VC
              WHERE VCV.VIN = &VIN
                AND VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER
                AND VC.COUNTRY_CODE = '&country_code'
                AND VC.LANGUAGE_CODE = '&language_code'
                AND VC.CAMPAIGN_TYPE = '&campaign_type'
                AND SYSDATE BETWEEN VCV.START_DATE AND VCV.END_DATE
                AND SYSDATE BETWEEN VC.START_DATE AND VC.END_DATE) A
    ORDER BY A.CAMPAIGN_PRIORITY DESC, A.END_DATE

  • Problem with MERGE statement

    Hi All,
    We are encountering a strange problem with the merge command.
    The following statement works :-
    merge into ATTRIBUTE_GROUP@US_PRODUCT_UAT a
    using
         select
              a1.group_id,
              a1.NAME,
              a1.CREATE_DATE,
              a1.MODIFY_DATE
         from
              ATTRIBUTE_GROUP_LOG a1,
              product_push_wrk a2
         where
              a2.column_id = a1.group_id and
              a2.modify_date = a1.modify_date ) b
    on ( a.group_id = b.group_id)
    when matched then
         update set
              a.NAME = b.NAME,
              a.CREATE_DATE = b.CREATE_DATE,
              a.MODIFY_DATE = b.MODIFY_DATE
    when not matched then
         insert
              a.group_id,
              a.NAME,
              a.CREATE_DATE,
              a.MODIFY_DATE
         values
              b.group_id,
              b.NAME,
              b.CREATE_DATE,
              b.MODIFY_DATE
    However when we change the order of the columns in the select query as follows the an error occurs : -
    merge into ATTRIBUTE_GROUP@US_PRODUCT_UAT a
    using
         select
              a1.NAME,
              a1.group_id,
              a1.CREATE_DATE,
              a1.MODIFY_DATE
         from
              ATTRIBUTE_GROUP_LOG a1,
              product_push_wrk a2
         where
              a2.column_id = a1.group_id and
              a2.modify_date = a1.modify_date ) b
    on ( a.group_id = b.group_id)
    when matched then
         update set
              a.NAME = b.NAME,
              a.CREATE_DATE = b.CREATE_DATE,
              a.MODIFY_DATE = b.MODIFY_DATE
    when not matched then
         insert
              a.group_id,
              a.NAME,
              a.CREATE_DATE,
              a.MODIFY_DATE
         values
              b.group_id,
              b.NAME,
              b.CREATE_DATE,
              b.MODIFY_DATE
    ERROR at line 15:
    ORA-00904: "B"."GROUP_ID": invalid identifier
    SQL> l 15
    15* on ( a.group_id = b.group_id)
    The structure of the attribute_log table is as follows :-
    SQL> desc ATTRIBUTE_GROUP
    Name Null? Type
    GROUP_ID NOT NULL NUMBER
    NAME NOT NULL VARCHAR2(96)
    CREATE_DATE NOT NULL DATE
    MODIFY_DATE NOT NULL DATE
    Any pointers to the cause of this error will be highly appreciated.
    Thanks and Regards,
    Suman

    The table structures are as follows :-
    04:17:17 SQL> desc product_push_wrk
    Name Null? Type
    COLUMN_ID NOT NULL NUMBER
    TYPE NOT NULL VARCHAR2(10)
    PARENT_COLUMN_ID NUMBER
    LEVEL_NO NUMBER
    MODIFY_DATE NOT NULL DATE
    04:17:25 SQL> desc ATTRIBUTE_GROUP_LOG
    Name Null? Type
    GROUP_ID NOT NULL NUMBER
    NAME NOT NULL VARCHAR2(96)
    CREATE_DATE DATE
    MODIFY_DATE DATE
    04:18:02 SQL> desc ATTRIBUTE_GROUP
    Name Null? Type
    GROUP_ID NOT NULL NUMBER
    NAME NOT NULL VARCHAR2(96)
    CREATE_DATE DATE
    MODIFY_DATE DATE

  • Strange results with Insert statement having select query

    Hi all,
    I am facing a strange issue with Insert statement based on a select query having multiple joins.
    DB- Oracle 10g
    Following is the layout of my query -
    Insert into Table X
    Select distinct Col1, Col2, Col3, Col4, Function(Col 5) from Table A, B
    where trunc(updated_date) > = trunc(sysdate-3)
    and join conditions for A, B
    Union
    Select Col1, Col2, Col3, Col4, Function(Col 5) from Table C, D
    trunc(updated_date) > = trunc(sysdate-3)
    and join conditions for C, D
    Union
    .... till 4 unions. all tables are residing in the local Database and not having records more than 50,000.
    If I execute above insert in a DBMS job, it results into suppose 50 records where as if I execute the select query it gives 56 records.
    We observed following things-
    a) no issue with size of tablespace
    b) no error while inserting
    c) since query takes lot of time so we have not used Cursor and PLSQL block for inserting.
    d) this discrepancy in number of records happens frequently but not everytime.
    e) examined the records left out from the insert, there we couldn't find any specific pattern.
    f) there is no constraint on the table X in which we are trying to insert. Also tables A, B, C....
    I went through this thread -SQL insert with select statement having strange results but mainly users are having either DB Links or comparison of literal dates, in my case there is none.
    Can somebody explain why is the discrepancy and what is the solution for it.
    Or atleast some pointers how to proceed with the analysis.
    Edited by: Pramod Verma on Mar 5, 2013 4:59 AM
    Updated query and added more details

    >
    Since I am using Trunc() in the where clause so timing should not matter much. Also I manually ruled out records which were updated after the job run.
    >
    The first rule of troubleshooting is to not let your personal opinion get in the way of finding out what is wrong.
    Actually this code, and the process it represents, is the most likely CAUSE of the problem.
    >
    where trunc(updated_date) > = trunc(sysdate-3)
    >
    You CANNOT reliably use columns like UPDATED_DATE to select records for processing. Your process is flawed.
    The value of that column is NOT the date/time that the data was actually committed; it is the date/time that the row was populated.
    If you insert a row into a table right now, using SYSDATE (8am on 3/5/2013) and don't commit that row until April your process will NEVER see that 3/5/2013 date until April.
    Here is the more typical scenario that I see all the time.
    1. Data is inserted/updated all day long on 3/4/2013.
    2. A column, for example UPDATED_DATE is given a value of SYSDATE (3/4/2013) in a query or by a trigger on the table.
    3. The insert/update query takes place at 11:55 PM - so the SYSDATE values are for THE DAY THE QUERY BEGAN
    4. The data pull begins at 12:05 am (on 3/5/2013 - just after midnight)
    5. The transaction is COMMITTED at 12:10 AM (on 3/5/2013); 5 minutes after the data pull began.
    That data extract in step 4 will NEVER see those records! They DO NOT EXIST when the data pull query is executed since they haven't been committed.
    Even worse, the next nights data pull will not see them either! That is because the next pull will pull data for 3/5/2013 but those records have a date of 3/4/2013. They will never get processed.
    >
    Job timing is 4am and 10pm EST
    >
    Another wrinkle is when data is inserted/updated from different timezones and the UPDATED_DATE value is from the CLIENT pc or server. Then you can get even more data missed since the client dates may be hours different than the server date used for the data pull process.
    DO NOT try to use UPDATED_DATE type columns to do delta extraction or you can have this issue.

  • Strange Problems with XDK v10 Beta Version

    Hello together,
    I encounter two strange problems with the new 10.1.0.0.0 Beta release of XDK. I already posted them in the Beta Release Testing Forum, but got no replies, so I decided to start another try here. Maybe anyone can help me...
    I upgraded a fine-working XSQL web application from XDK 9.2.0.4 to the new 10.1.0.0.0 Beta release of XDK. Since then, two bugs came up, which are reproducible by will:
    1.)
    When processing XSQL insert-requests, the error given below is thrown. I already found an entry in the bug database that says that exactly this error should have been fixed since 9.2.0.3 (see http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=230695.1), but no it seems to be there again.
    This is the stack trace:
    XSQL-017: Unexpected Error Occurred
    java.lang.NoClassDefFoundError: oracle/sql/OPAQUE
    at oracle.xml.xsql.actions.XSQLInsertRequestHandler.handleAction(XSQLInsertRequestHandler.java:118)
    at oracle.xml.xsql.XSQLDocHandler.getDocument(XSQLDocHandler.java:158)
    at oracle.xml.xsql.XSQLPageProcessor.process(XSQLPageProcessor.java:171)
    at oracle.xml.xsql.XSQLServlet.doGet(XSQLServlet.java:61)
    at oracle.xml.xsql.XSQLServlet.doPost(XSQLServlet.java:82)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5412)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:744)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3086)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2544)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    2.)
    When I deploy and start the application now, I always get the following error only once(!) after deployment when I call the application for the first time:
    XSQL-017: Unexpected Error Occurred
    java.lang.NullPointerException
    at weblogic.jdbc.oci.Statement.executeQuery(Statement.java:865)
    at oracle.xml.xsql.actions.XSQLQueryHandler.handleAction(XSQLQueryHandler.java:161)
    at oracle.xml.xsql.XSQLDocHandler.getDocument(XSQLDocHandler.java:158)
    at oracle.xml.xsql.XSQLPageProcessor.process(XSQLPageProcessor.java:171)
    at oracle.xml.xsql.XSQLServlet.doGet(XSQLServlet.java:61)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5412)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:744)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3086)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2544)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    When I reload the same page, it works. However, this is not really a good state for productive use.
    Any ideas? After days of research, I'd be very glad for any help.
    Thanks alot,
    Eckhard

    Once again me:
    I guess I should partially revoke for the second topic: The error described above under 2.) seems to be rather a Weblogic versioning problem than a XDK bug, as it only occurs when deploying the application to WebLogic 7.0 (instead of 6.1, which was used before). Maybe I should search the BEA docs for an answer.
    However, the first bug is still a problem to me...

  • Strange problem with Subviews on 1.0 Beta

    Hi,
    I'm having a strange problem with SubViews on 1.0 Beta. I'm not sure If I'm being stupid and have done something wrong, or if there's a problem here.
    My application is directly based on one of the examples, so the structure etc is almost identical. I've simplified the files below to avoid confusing the issue.
    The default landing page (greeting.jsp) looks like this:
    <%@ taglib declarations for HTML and CORE taglibs %>
    <HTML>
    <HEAD><title>Insulation Layer Demo</title></HEAD>
    <body bgcolor="white">
    <f:view>
    <jsp:include page="sysstatus.jsp" />
    <!-- other strictly HTML content -->
    </f:view>
    </body>
    </HTML>
    sysstatus.jsp looks like this:
    <%@ taglib declarations for HTML and CORE taglibs %>
    <f:subview id="SystemStatusView">
    <h:form id="systemStatusForm">
    <p><h:selectboolean_checkbox id="System1Available" value="#{SystemStatus.system1Available}"/>System 1<br/>
    <h:selectboolean_checkbox id="System2Available" value="#{SystemStatus.system2Available}"/>System 2</p>
    <p><h:command_button id="submit" action="success" value="submit" /></p>
    </h:form>
    </f:subview>When I view this page, the checkboxes all seem to work okay (in that their state is preserved across calls etc), but the formatting is very screwy. The resulting page looks something like:
    <chkbox1> <chkbox2> <Submit>
    System 1
    System 2
    <Other HTML content from greeting.jsp>When I look at the HTML source code being generated, it is genuinly being generated as above, that is, all the form tags first, and then the rest of the content. Interestinly, I tried adding a ${SystemStatus.system2Available} into the body text, and it was rendered as literal text (i.e. not evaluated as EL), which is very curious -- makes me wonder if the included file is included as text, rather than JSP, although the custom taglibs and <f:form> tags etc are not in the generated HTML.
    If I lift all the content between the <h:form> tags (inclusive) out of sysstatus.jsp and put it in greeting.jsp in place of the <jsp:include> tag, all is well.
    Any ideas? All help gratefully recieved!
    Thanks,
    Paul

    Personally, I think it is a bug in the rendering model of JSF itself because if you include any non-JSF tags, they don't get rendered according to my understanding of the what the spec says (in the location the tags are written).
    The only workaround that I could come up with is to use straight JSF tags in all of your layers. Things are then rendered the way that they "should" be rendered.
    You could try wrapping all of your HTML tags in <f:verbatim> tags and see if that helps.
    Good luck!
    David

  • Strange problem with ACLs

    Hi,
    I have just migrated an oracle database from 11.1.0.7 on Win Server 2003 to 11.2 on Linux 64 bit. I am having a strange problem with ACLs - I can create the ACL but when I perform either of the following two commands:
    SELECT * FROM DBA_NETWORK_ACLS
    or
    SELECT * FROM NET$_ACL
    I get no rows returned. The ACL exists somehow because if I try and create it again I get the error that it exists. Has anyone got any advice here? Something is out of sync and I need to know how to fix it up.
    Thanks
    Adam

    BEGIN
    DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (
    acl => 'email_server_acl.xml',
    description => 'Network connection Email Server',
    principal => 'MAIL',
    is_grant => TRUE,
    privilege => 'connect');
    END;
    PL/SQL procedure successfully completed.
    select * from DBA_NETWORK_ACLS;
    (no rows)
    BEGIN
    DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (
    acl => 'email_server_acl.xml',
    description => 'Network connection Email Server',
    principal => 'MAIL',
    is_grant => TRUE,
    privilege => 'connect');
    END;
    ORA-31003: Parent /sys/acls/ already contains child entry email_server_acl.xml
    ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 252
    ORA-06512: at line 2
    Edited by: Adam J. Sawyer on 15/04/2011 17:08

Maybe you are looking for

  • I can no longer download anything

    For some reason, I can no longer download anything on itunes on my computer. When I try, I get the following error as a sample... There were problems downloading some purchased items. For more information on the items that could not be downloaded, cl

  • Problems with creating a ringtone

    Only having one problem when Im creating a ringtone, when your editing your ringtone at the bottom of iTunes, my screen doesn't fully open up to display the "buy" button. I have tried to slide over to it every way I know can think of but I still can'

  • Firefox is already in use error (even after other support)

    first, I want to start off by telling you I've tried all the other steps before even posting this. 1. The parent.lock file only opens when firefox is open, and I can't delete the file while firefox is open 2. I click off the read only on the profile

  • Keyboard shortcut to open Preview?

    When I want to scroll through a folder with pictures, I usually drag the folder from the Finder to the Preview icon in my dock. Is there a way to open Preview with a keyboard shortcut? I know about pressing the spacebar to open Quicklook, but I prefe

  • ITunes for OS 9

    Can anyone tell me what is the newest version of iTunes that will run on OS 9.2 and where I might find it? I have an old iMac that I let my kids use and I want to put their music on it. Thanks.