Help with sql statements and Java

Hi,
How can I create a string kind of like this
Select * From Students Where Name Like "Bob Burns";
As the sql statement might indicate I am using MS Access. I seem to be having problems with the double quotes required by the Like operator in MS Access, Java views that as a beginning of a string as oppposed to an actual string value.

Like this:
    Connection connection = null;
    PreparedStatement stmt = null;
    ResultSet res = null;
    try  {
        connection = ...get from connection pool...;
        String sql = "select ... from ... where name like ?";
        stmt = connection.prepareStatement(sql);
        stmt.setObject(1, "%Bob%", java.sql.Types.VARCHAR);
        res = stmt.executeQuery();
        while (res.next()) { ...the usual...; }
    } finally {
        ...close res, stmt & return connection to pool...
    }You can try stmt.setString() instead of setObject() but rumor has it that some mssql drivers have a bug that makes setString() not work with "like", but oddly enough setObject() works.

Similar Messages

  • Import and process larger data with SQL*Loader and Java resource

    Hello,
    I have a project to import data from a text file in a schedule. A lager data, with nearly 20,000 record/1 hours.
    After that, we have to analysis the data, and export the results into a another database.
    I research about SQL*Loader and Java resource to do these task. But I have no experiment about that.
    I'm afraid of the huge data, Oracle could be slowdown or the session in Java Resource application could be timeout.
    Please tell me some advice about the solution.
    Thank you very much.

    With '?' mark i mean " How i can link this COL1 with column in csv file ? "
    Attilio

  • Error with Sql Server and Java App

    Hi i have a java based multithread application which comunicate with SQL SERVER via DSN bridge , some time my application crashes with this error any idea what its happend and how to remove it .
    Thanks
    ************* Exception ********************************8
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x77F87EEB
    Function=RtlEnterCriticalSection+0xB
    Library=F:\WINNT\system32\ntdll.dll
    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.numResultCols(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLNumResultCols(JdbcOdbc.java:4625)
    at sun.jdbc.odbc.JdbcOdbcStatement.getColumnCount(JdbcOdbcStatement.java:1235)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:352)
    - locked <04DC3EE0> (a sun.jdbc.odbc.JdbcOdbcStatement)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
    at advcomm.advrad.DBParams.Ltht(Unknown Source)
    at advcomm.advrad.DBParams.BDhb(Unknown Source)
    at advcomm.advrad.DlkhlHz.run(Unknown Source)
    Dynamic libraries:
    0x00400000 - 0x00406000 F:\j2sdk1.4.1_03\bin\java.exe
    0x77F80000 - 0x77FFC000 F:\WINNT\system32\ntdll.dll
    0x7C2D0000 - 0x7C335000 F:\WINNT\system32\ADVAPI32.dll
    0x7C570000 - 0x7C623000 F:\WINNT\system32\KERNEL32.dll
    0x77D30000 - 0x77DA8000 F:\WINNT\system32\RPCRT4.dll
    0x78000000 - 0x78045000 F:\WINNT\system32\MSVCRT.dll
    0x75030000 - 0x75044000 F:\WINNT\system32\WS2_32.DLL
    0x75020000 - 0x75028000 F:\WINNT\system32\WS2HELP.DLL
    0x6D340000 - 0x6D46B000 F:\j2sdk1.4.1_03\jre\bin\client\jvm.dll
    0x77E10000 - 0x77E79000 F:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F7C000 F:\WINNT\system32\GDI32.dll
    0x77570000 - 0x775A0000 F:\WINNT\system32\WINMM.dll
    0x6D1E0000 - 0x6D1E7000 F:\j2sdk1.4.1_03\jre\bin\hpi.dll
    0x6D310000 - 0x6D31E000 F:\j2sdk1.4.1_03\jre\bin\verify.dll
    0x6D220000 - 0x6D239000 F:\j2sdk1.4.1_03\jre\bin\java.dll
    0x6D330000 - 0x6D33D000 F:\j2sdk1.4.1_03\jre\bin\zip.dll
    0x6D260000 - 0x6D26B000 F:\j2sdk1.4.1_03\jre\bin\JdbcOdbc.dll
    0x1F7A0000 - 0x1F7DA000 F:\WINNT\system32\ODBC32.dll
    0x71710000 - 0x71794000 F:\WINNT\system32\COMCTL32.dll
    0x7CF30000 - 0x7D175000 F:\WINNT\system32\SHELL32.dll
    0x70A70000 - 0x70AD6000 F:\WINNT\system32\SHLWAPI.dll
    0x76B30000 - 0x76B6E000 F:\WINNT\system32\comdlg32.dll
    0x1F840000 - 0x1F857000 F:\WINNT\system32\odbcint.dll
    0x1F9C0000 - 0x1FA27000 F:\WINNT\System32\SQLSRV32.dll
    0x41090000 - 0x410BD000 F:\WINNT\System32\SQLUNIRL.dll
    0x77800000 - 0x7781E000 F:\WINNT\System32\WINSPOOL.DRV
    0x76620000 - 0x76631000 F:\WINNT\system32\MPR.DLL
    0x77820000 - 0x77827000 F:\WINNT\system32\VERSION.dll
    0x759B0000 - 0x759B6000 F:\WINNT\system32\LZ32.DLL
    0x779B0000 - 0x77A4B000 F:\WINNT\system32\OLEAUT32.dll
    0x7CE20000 - 0x7CF0F000 F:\WINNT\system32\ole32.dll
    0x7CDC0000 - 0x7CE13000 F:\WINNT\System32\NETAPI32.dll
    0x77980000 - 0x779A4000 F:\WINNT\System32\DNSAPI.dll
    0x75050000 - 0x75058000 F:\WINNT\System32\WSOCK32.dll
    0x751C0000 - 0x751C6000 F:\WINNT\System32\NETRAP.dll
    0x77BF0000 - 0x77C01000 F:\WINNT\System32\NTDSAPI.dll
    0x77950000 - 0x7797B000 F:\WINNT\system32\WLDAP32.DLL
    0x7C340000 - 0x7C34F000 F:\WINNT\System32\SECUR32.DLL
    0x75150000 - 0x75160000 F:\WINNT\System32\SAMLIB.dll
    0x769A0000 - 0x769A7000 F:\WINNT\system32\NDDEAPI.DLL
    0x1FA30000 - 0x1FA46000 F:\WINNT\System32\sqlsrv32.rll
    0x1F7F0000 - 0x1F80A000 F:\WINNT\system32\odbccp32.dll
    0x74CB0000 - 0x74CCA000 F:\WINNT\system32\DBNETLIB.DLL
    0x75500000 - 0x75504000 F:\WINNT\system32\security.dll
    0x782D0000 - 0x782F2000 F:\WINNT\system32\msv1_0.dll
    0x7C740000 - 0x7C7CC000 F:\WINNT\system32\CRYPT32.dll
    0x77430000 - 0x77441000 F:\WINNT\system32\MSASN1.dll
    0x77340000 - 0x77353000 F:\WINNT\system32\iphlpapi.dll
    0x77520000 - 0x77525000 F:\WINNT\system32\ICMP.DLL
    0x77320000 - 0x77337000 F:\WINNT\system32\MPRAPI.DLL
    0x773B0000 - 0x773DF000 F:\WINNT\system32\ACTIVEDS.DLL
    0x77380000 - 0x773A3000 F:\WINNT\system32\ADSLDPC.DLL
    0x77830000 - 0x7783E000 F:\WINNT\system32\RTUTILS.DLL
    0x77880000 - 0x7790E000 F:\WINNT\system32\SETUPAPI.DLL
    0x7C0F0000 - 0x7C154000 F:\WINNT\system32\USERENV.DLL
    0x774E0000 - 0x77514000 F:\WINNT\system32\RASAPI32.DLL
    0x774C0000 - 0x774D1000 F:\WINNT\system32\rasman.dll
    0x77530000 - 0x77552000 F:\WINNT\system32\TAPI32.dll
    0x77360000 - 0x77379000 F:\WINNT\system32\DHCPCSVC.DLL
    0x74CD0000 - 0x74CD8000 F:\WINNT\system32\DBmsLPCn.dll
    0x0B990000 - 0x0B9E6000 F:\WINNT\system32\MSVCR71.dll
    0x6D2E0000 - 0x6D2EE000 F:\j2sdk1.4.1_03\jre\bin\net.dll
    0x782C0000 - 0x782CC000 F:\WINNT\System32\rnr20.dll
    0x777E0000 - 0x777E8000 F:\WINNT\System32\winrnr.dll
    0x777F0000 - 0x777F5000 F:\WINNT\system32\rasadhlp.dll
    0x74FD0000 - 0x74FEE000 F:\WINNT\system32\msafd.dll
    0x75010000 - 0x75017000 F:\WINNT\System32\wshtcpip.dll
    0x77920000 - 0x77943000 F:\WINNT\system32\imagehlp.dll
    0x72A00000 - 0x72A2D000 F:\WINNT\system32\DBGHELP.dll
    0x690A0000 - 0x690AB000 F:\WINNT\system32\PSAPI.DLL
    Local Time = Wed Mar 08 17:24:41 2006
    Elapsed Time = 9294
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.1_03-b02 mixed mode)
    #

    I'm having the same problem.
    One potential solutions is to use a custom SQL server JDBC driver instead of going through the ODBC bridge. This will minimize dependencies and should also improved performance. Hope this helps.
    - Joe

  • Help with SQL statement in a coldfusion application

    I created 2 drop down list boxes one that contains the months
    and the second that contains the year. Right now my sql statement
    is Select * from job where releaseDate=#imageDate#. Now this was
    written in 2006 and I didn't know they were going to continue to
    use the tool in 2007. So now I need a sql statement that if a user
    selects Jan 2007 that all of jan 2007 will display. The format for
    the datetime field in the database is Jan 2 2007 hh:mm:ss the first
    box is named imageDate and the second is called StatusDate

    Take a look at the T-SQL datepart function.
    Bryan Ashcraft (remove BRAIN to reply)
    Web Application Developer
    Wright Medical Technology, Inc.
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) ::
    http://www.adobe.com/communities/experts/
    "rere" <[email protected]> wrote in message
    news:fjp4im$fqk$[email protected]..
    >I created 2 drop down list boxes one that contains the
    months and the
    >second
    > that contains the year. Right now my sql statement is
    Select * from job
    > where
    > releaseDate=#imageDate#. Now this was written in 2006
    and I didn't know
    > they
    > were going to continue to use the tool in 2007. So now I
    need a sql
    > statement
    > that if a user selects Jan 2007 that all of jan 2007
    will display. The
    > format
    > for the datetime field in the database is Jan 2 2007
    hh:mm:ss the first
    > box is
    > named imageDate and the second is called StatusDate
    >

  • Help with SQL statements please.... URGENT PLEASE!!!!

    I have 2 Tables
    TABLE_NAME COLUMN_NAME DATA_TYPE
    TASTEWINE TWDATE DATE
    TASTEWINE BIN NUMBER
    TASTEWINE QUANTITY NUMBER
    TASTING TDATE DATE
    TASTING PLACE VARCHAR2
    a) Table TASTING has 2 columns.... TDATE( date Tasting was Held) and PLACE ( locations at which Tasting was held)
    b) Table TASTEWINE has 3 Columns.............. TWDATE( wine tasting date, BIN( ID number for type of wine that was tasted), AND QUANTITY( quantity of win consumed by bottles)
    Here is the QUestion.... I am having a hard time figuring out how to connect those two tables based on this information .. What I want to do is this.....select the total number of bottles of wine served at each wine-tasting, but only for the second half of the year 1999, and I want to see not only the date and total bottles served, but also the location where the wine-tasting took place. I also want to display the date, the place, and total quantity.
    Can Anyone please Help me??

    Hi,
    Your query works fine - as well as the one mentioned by Alok. I have tired it with some sample values, and both show the same results:-
    The two tables :-
    CREATE TABLE TASTEWINE
         TWDATE     DATE,
         BIN     NUMBER,
         QUANTITY NUMBER
    CREATE TABLE TASTING
         TDATE DATE,
         PLACE VARCHAR2(100)
    );Rows in the Tables:-
    INSERT INTO TASTEWINE VALUES (TO_DATE('01/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('02/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('03/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('04/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('05/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('06/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('07/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('08/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('09/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('10/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('11/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('12/12/1999','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('01/12/2000','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('02/12/2000','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('03/12/2000','MM/DD/YYYY'),1,100);
    INSERT INTO TASTEWINE VALUES (TO_DATE('04/12/2000','MM/DD/YYYY'),1,100);
    COMMIT;
    INSERT INTO TASTING VALUES (TO_DATE('01/12/1999','MM/DD/YYYY'),'SEATTLE');
    INSERT INTO TASTING VALUES (TO_DATE('02/12/1999','MM/DD/YYYY'),'SAN FRANSICO');
    INSERT INTO TASTING VALUES (TO_DATE('03/12/1999','MM/DD/YYYY'),'DENVER');
    INSERT INTO TASTING VALUES (TO_DATE('04/12/1999','MM/DD/YYYY'),'AUSTIN');
    INSERT INTO TASTING VALUES (TO_DATE('05/12/1999','MM/DD/YYYY'),'SALT LAKE CITY');
    INSERT INTO TASTING VALUES (TO_DATE('06/12/1999','MM/DD/YYYY'),'LOS ANGLES');
    INSERT INTO TASTING VALUES (TO_DATE('07/12/1999','MM/DD/YYYY'),'PORTLAND');
    INSERT INTO TASTING VALUES (TO_DATE('08/12/1999','MM/DD/YYYY'),'NEW YORK');
    INSERT INTO TASTING VALUES (TO_DATE('09/12/1999','MM/DD/YYYY'),'NEWARK');
    INSERT INTO TASTING VALUES (TO_DATE('10/12/1999','MM/DD/YYYY'),'EL PASO');
    INSERT INTO TASTING VALUES (TO_DATE('11/12/1999','MM/DD/YYYY'),'AUSTIN');
    INSERT INTO TASTING VALUES (TO_DATE('12/12/1999','MM/DD/YYYY'),'CHICAGO');
    INSERT INTO TASTING VALUES (TO_DATE('01/12/2000','MM/DD/YYYY'),'ATLANTA');
    INSERT INTO TASTING VALUES (TO_DATE('02/12/2000','MM/DD/YYYY'),'HOLLYWOOD');
    INSERT INTO TASTING VALUES (TO_DATE('03/12/2000','MM/DD/YYYY'),'');
    INSERT INTO TASTING VALUES (TO_DATE('04/12/2000','MM/DD/YYYY'),'SEATTLE');
    COMMIT;The First Query :-
    SELECT
         A.TWDATE,
         B.PLACE,
         SUM(A.QUANTITY)
    FROM
         TASTEWINE     A,
         TASTING          B
    WHERE
              A.TWDATE = B.TDATE
         AND     B.TDATE > TO_DATE('01/07/1999', 'DD/MM/YYYY')
         AND     B.TDATE < TO_DATE('01/01/2000', 'DD/MM/YYYY')
    GROUP BY
         A.TWDATE,
         B.PLACE;The Second Query :-
    SELECT
         A.TWDATE,
         B.PLACE,
         SUM(A.QUANTITY)
    FROM
         TASTEWINE     A,
         TASTING          B
    WHERE
              A.TWDATE = B.TDATE
         AND     B.TDATE
                   BETWEEN
                        TO_DATE('01/07/1999', 'DD/MM/YYYY')      AND
                        TO_DATE('01/01/2000', 'DD/MM/YYYY')
    GROUP BY
         A.TWDATE,
         B.PLACE;Regards,
    Sandeep

  • Help with SQL Query and dates

    I am trying to return results between a year or 365 days. I need to run this at any time and return a year prior. I'm not getting any results? Any help? THX!
    SELECT
    NAME.ID,
    Activity.UF_2,
    Name.FIRST_NAME,
    Name.LAST_NAME,
    Name.EMAIL,
    Activity.TRANSACTION_DATE
    FROM
    Activity INNER
    JOIN Name
    ON Activity.ID
    = Name.ID
    Where
    activity.TRANSACTION_DATE
    BETWEEN
    CAST(CAST(DATEADD(DAY,
    -365,
    GETDATE())
    AS
    DATE)
    AS
    DATETIME)
    AND
    DATEADD
    (SECOND,
    -1,
    DATEADD(DAY,
    1,
    CAST(CAST(DATEADD(DAY,
    -365,
    GETDATE())
    AS
    DATE)
    AS
    DATETIME)))
    and Activity.UF_1
    =
    'a'
    and Activity.UF_2
    =
    'NAT'

    Where activity.TRANSACTION_DATE >= DATEADD(YEAR, -1, GETDATE()) AND activity.TRANSACTION_DATE < GETDATE()

  • Problems with SQL*Loader and java Runtime

    Hi. I'm trying to start SQL*Loader on Oracle 8 by using Runtime class in this way:
    try{
    Process p = Runtime.getRuntime().exec( "c:\oracle\ora81\bin\sqlldr.exe parfile=c:\parfile\carica.par" );
    /*If i insert this line my application never stops*/
    p.waitFor();
    }catch( Exception e ){
    . I have seen that if lines to insert are less then 400 all works very fine, but if lines number is greater than 400, all data go in my tables but my log file is opened always in writing.Can anyone tell me why?
    Thanks

    Just a note if the executable "sqlldr.exe" does not stop (quit running) by itself the p.waitFor() will wait for ever.

  • Need help on SQL Statement for UDF

    Hi,
    as I am not so familiar with SQL statements on currently selected values, I urgently need help.
    The scenario looks as follows:
    I have defined two UDFs named Subgroup1 and Subgroup2 which represent the subgroups dependent on my article groups. So for example: When the user selects article group "pianos", he only sees the specific subgroups like "new pianos" and "used pianos" in field "Subgroup1". After he has selected one of these specific values, he sees only the specific sub-subgroups in field "Subgroup2", like "used grand pianos".
    I have defined UDTs for both UDFs. The UDT for field "Subgroup1" has a UDF called "ArticleGroup" which represents the relation to the article group codes. The UDT for field "Subgroup2" has a UDF called "Subgroup1" which represents the relation to the subgroups one level higher.
    The SQL statement for the formatted search in field "Subgroup1" looks as follows:
    SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP1]  T0 WHERE T0.[U_ArticleGroup]  = (SELECT $[OITM.ItmsGrpCod])
    It works fine.
    However, I cannot find the right statement for the formatted search in field "Subgroup2".
    Unfortunately this does NOT WORK:
    SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2]  T0 WHERE T0.[U_Subgroup1]  = (SELECT $[OITM.U_Subgroup1])
    I tried a lot of others that didn't work either.
    Then I tried the following one:
    SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2]  T0 WHERE T0.[U_Subgroup1] = (SELECT T1.[Code] FROM [dbo].[@B_SUBGROUP1] T1 WHERE T1.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod]))
    Unfortunately that only works as long as there is only one specific subgroup1 for the selected article group.
    I would be sooooo happy if there is anyone who can tell me the correct statement for my second UDF!
    Thanks so much in advance!!!!
    Edited by: Corinna Hochheim on Jan 18, 2010 10:16 PM
    Please ignore the "http://" in the above statements - it is certainly not part of my SQL.
    Please also ignore the strikes.

    Hello Dear,
    Use the below queries to get the values:
    Item Sub Group on the basis of Item Group
    SELECT T0.[Name] FROM [dbo].[@SUBGROUP]  T0 WHERE T0.[U_GroupCod] =$[OITM.ItmsGrpCod]
    Item Sub Group 1 on the basis of item sub group
    SELECT T0.[Name] FROM [dbo].[@SUBGROUP1]  T0 WHERE T0.[U_SubGrpCod]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP]  T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp])
    Sub group 2 on the basis of sub group 1
    SELECT T0.[Name] FROM [dbo].[@SUBGROUP2]  T0 WHERE T0.[U_SubGrpCod1]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP1]  T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp1])
    this will help you.
    regards,
    Neetu

  • Convert a logic from SQL statement to java

    Hi.,
    I m using jdeveloper 11.1.1.5
    I had used one sql statement as gievn below
    (SELECT max(decode(LENGTH(fy_year),4, fy_year + 1,6,SUBSTR(fy_year, 1, 4)+1||SUBSTR(SUBSTR(fy_year, 1, 4) + 2, 3, 2)))YEAR from fin_years)I need to use this logic in java
    Could anyone pls help me

    "wilhelm,"
    I've seen some ridiculous questions in my life. This is one of them.
    There are just so many things wrong here. So, so many.
    SELECT statements get data from databases; they are not "logic."
    Do you really expect us to parse your SQL and try to guess what it is supposed to do?
    Do you really believe that when converting a Forms app to Java that you "convert" SQL statements to Java?
    Do you really believe that going through your forms app and "converting" it to ADF is a sensible approach?
    John

  • Capture all SQL statements and archive to file in real time

    Want to Capture all SQL statements and archive to file in real time?
    Oracle Session Manager is the tool just you need.
    Get it at http://www.wangz.net
    This tools monitor how connected sessions use database instance resources in real time. You can obtain an overview of session activity sorted by a statistic of your choosing. For any given session, you can then drill down for more detail. You can further customize the information you display by specifying manual or automatic data refresh, the rate of automatic refresh.
    In addition to these useful monitoring capabilities, OSM allows you to send LAN pop-up message to users of Oracle sessions.
    Features:
    --Capture all SQL statement text and archive to files in real time
    --Pinpoints problematic database sessions and displays detailed performance and resource consumption data.
    --Dynamically list sessions holding locks and other sessions who are waiting for.
    --Support to kill several selected sessions
    --Send LAN pop-up message to users of Oracle sessions
    --Gives hit/miss ratio for library cache,dictionary cache and buffer cache periodically,helps to tune memory
    --Export necessary data into file
    --Modify the dynamic system parameters on the fly
    --Syntax highlight for SQL statements
    --An overview of your current connected instance informaiton,such as Version, SGA,License,etc
    --Find out object according to File Id and Block Id
    Gudu Software
    http://www.wangz.net

    AnkitV wrote:
    Hi All
    I have 3 statements and I am writing some thing to a file using UTL_FILE.PUT_LINE after each statement is over. Each statement takes mentioned time to complete.
    I am opening file in append mode.
    statement1 (takes 2 mins)
    UTL_FILE.PUT_LINE
    statement2 (takes 5 mins)
    UTL_FILE.PUT_LINE
    statement3 (takes 10 mins)
    UTL_FILE.PUT_LINE
    I noticed that I am able to see contents written by UTL_FILE.PUT_LINE only after statement3 is over, not IMMEDIATELY after statement1 and statement2 are done ?
    Can anybody tell me if this is correct behavior or am I missing something here ?Calling procedure must terminate before data is actually written to the file.
    It is expected & correct behavior.

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • Help with dynamic statement returning values into collection

    Hi All
    I am trying to use dynamic statement to return values into a collection using the returning clause. However, I get an ORA-00933 error. Here is a simple setup:
    create table t(
        pk number,
        id_batch varchar2(30),
        date_created date,
        constraint t_pk primary key ( pk )
    create or replace type num_ntt is table of number;
    create or replace type vc2_ntt is table of varchar2(30);
    create or replace
    package pkg
    as
      type rec is record(
          pk        num_ntt,    
          id_batch  vc2_ntt
      procedure p(
          p_count in number,
          p_rt    out nocopy rec
    end pkg;
    create or replace
    package body pkg
    as
      procedure p(
          p_count in number,
          p_rt    out nocopy rec
      is
      begin
          execute immediate '
          insert into t
          select level, ''x'' || level, sysdate
          from   dual
          connect by level <= :p_count
          returning pk, id_batch into :pk, :id_batch'
          using p_count returning bulk collect into p_rt.pk, p_rt.id_batch;
      end p;
    end pkg;
    declare
      r  pkg.rec;
    begin
      pkg.p( 5, r );
    end;
    /

    sanjeevchauhan wrote:
    but I am working with dynamic statement and returning multiple fields into a collection.And using an INSERT...SELECT statement combined with a RETURNING INTO clause still does not work. Whether it's dynamic SQL or not: it doesn't work. The link describes a workaround.
    By the way, I don't see why you are using dynamic SQL here. Static SQL will do just fine. And so you can literally copy Adrian's setup.
    Regards,
    Rob.

  • How to isolate the Sql Statement from Java Code

    Hi
    I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
    So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
    Suppose the developer has these four Statements
    Select ename,empno,sal,job from emp;
    select empno,ename,mgr from emp;
    select deptno,dname from dept;
    select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
    So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
    Can Anybody guide me how to write this Stored type of Store procedure.
    Thanks

    http://www.google.com/search?q=java+windows+registry
    Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this.

  • Need help with Blog, Wiki and Gallery

    Hi Team,
    Need help with Blog, Wiki and Gallery startup. I have newly started visiting forums and quite interested to contribute towards these areas also.
    Please help.
    Thanks,
    Santosh Singh
    Santosh Singh

    Hello Santhosh,
    Blog is for Microsoft employees only. However, you can contribute towards WIKI and GALLERY using the below links.
    http://social.technet.microsoft.com/wiki/
    http://gallery.technet.microsoft.com/

  • What's the phone number I should call for help with my iPhone and ihome dock?

    What's the phone number I should call for help with my iPhone and ihome dock?

    http://www.ihomeaudio.com/support/

Maybe you are looking for