Prepared SQL statement to test existence of a value in a row

Excuse my ignorance in SQL. I didn't do much in SQL queries or DB design in general, but I'm eager to learn.
Idea behind: I'm traversing a directory tree (Java, jdbc) (depth first) and want to collect all files
in that tree and put the as BLOBS into the database.
To find out whether a file is the same as another file (possibly in a different path) I calculate the md5sum
(not sure whether it is proof against collisions or if I should use SHA-256 or some combination of md5sum + chksum).
Anyway, let the md5sum be the unique value that makes the identity of a file for now.
My problem: Find the jdbc/SQL statements that let me decide whether the file (md5sum) is already stored in a ROW
upon which I can decide to either do the INSERT or mark the existing file as being present in a different path.
I stumbled across the problem in the moment when I first time tried to INSERT a row and got told that
md5sum gotta be unique.
Any ideas for design and query? The code example below is incomplete. Especially what I'm looking for is
how to construct a prepared SQL statement into which I can inject the variable later found (md5sum)
Whether I should do that by COUNT(*) or a different method?
Christoph
Here is my sketchy code (Netbeans project) under construction:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package testsqlite;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.*;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
* @author chris
public class Main {
* @param args the command line arguments
private static Connection conn;
private static String sql="INSERT INTO part(name,md5sum) VALUES (?,?)";
private static PreparedStatement pstmnt,pstmnt_ifexists ;
private static String sql_ifexists="SELECT COUNT(*) FROM part WHERE md5sum=?"; // ???
public static void main(String[] args) throws Exception{
// TODO code application logic here
System.out.println("Testsuite-Collector\n");
String path="c:/usr/local/www/data/testsuite/mandanten/chris/probanden";
File f = new File(path);
Class.forName ("org.sqlite.JDBC");
conn =
DriverManager.getConnection("jdbc:sqlite:c:/users/chris/testsuite/versionen");
Statement stat = conn.createStatement();
pstmnt = conn.prepareStatement(sql);
pstmnt_ifexists = conn.prepareStatement(sql_ifexists);
// process
Traverse(f);
// watch result
ResultSet rs = stat.executeQuery("select * from part;");
while (rs.next()) {
System.out.print("name=" + rs.getString("name") + " ");
System.out.println("md5sum= " + rs.getString("md5sum"));
rs.close();
conn.close();
private static void Traverse(File f) throws IOException {
File[] files = f.listFiles();
for( File file : files) {
if(file.isDirectory()){
Traverse(file);
else {
try {
if(file.length() > 0){
FileInputStream fis = new FileInputStream( file );
String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex( fis );
System.out.println(file.length() +" " md5"->"+file.getPath());
// check whether md5sum is already existing
pstmnt_ifexists=?????
pstmnt.setString(1, file.getPath());
pstmnt.setString(2, md5);
pstmnt.executeUpdate();
catch (SQLException e) {
System.out.println("SQL error:" e.getMessage()"\n");
}

And you seriously think that attempting to insert a record and catching the error of it failing is a good design!?!?I certainly do. I agree with Peter here. You can either test for the existence of the record and insert it if absent, or insert the record willy-nilly and catch the exception. The second option is (a) atomic even without transactions and (b) clearly twice as efficient. Same consideration applies to e.g.
if (!map.containsKey(key))
  map.put(key, value);
else
  ; // it was already thereas opposed to
if (!map.put(key, value)
  ; // it was already thereand many other situations of this kind, e.g.
try
  if (InetAddress.isReachable(ip))
    s = new Socket(ip, port);
  else
    ; // host not up
catch (ConnectException exc)
  // the host wasn't up during connect
}as opposed to
try
  s = new Socket(ip, port);
catch (ConnectException exc)
  // host not up
}or
try
  if (file.exists())
    in = new FileInputStream(file);
  else
    ; // it wasn't there
catch (IOException exc)
  // it wasn't there, etc ...
}as opposed to
try
  in = new FileInputStream(file);
catch (FileNotFoundException exc)
  // it wasn't there
}Slight absence of timing window problems in the cases that detect via exceptions, and considerably simpler code. Phobias about how to use exception handling need to be overcome.
I've also had it seriously argued to me that you shouldn't catch EOFExceptions, merely change the format of your file so you 'know' when one is coming up. Sorry to say that I think this sort of thing is complete rubbish. There is a need for an out of band EOF signal with all the readXXX() methods, and this is it.

Similar Messages

  • SQL statement for test conn on reserve

    Hi,
    We use the following statement when testing connections on reserve:
    select count(*) from SYSOBJECTS
    This seems rather expensive. Is there a better performing statement we can use for testing connections.
    Thanks in advance.
    pat

    Pat Bumpus wrote:
    Hi,
    We use the following statement when testing connections on reserve:
    select count(*) from SYSOBJECTS
    This seems rather expensive. Is there a better performing statement we can use for testing connections.
    Thanks in advance.
    pat
    Absolutely! This sounds like it's Sybase or MS SQLServer. Just change the
    'test table' to "SQL select 1"
    Joe

  • Need SQL statement to generate a sequence number in the output rows

    Hi folks. I need to create an SQL statement that generates a sequence number column in the output rows (records) such that the first returned row has this column set to 1, second returned row has the column set to 2, etc.
    For example, consider the query:
    SELECT income from employees WHERE income != 20000 ORDER BY income;
    If employees.income contains 60,000, 20,000, 35,000, and 19,000 for respective rows, the output would be this:
    19,000
    35,000
    60,000
    I would like the SQL to also return a sequence number that is computed across the returned rows, resulting in two output columns:
    1 19,000
    2 35,000
    3 60,000
    Is there a simple SQL function that generates the sequence number, in order, and only for the returned rows? Or is there another way?
    I'm stumped. Any help is appreciated! Thanks!
    - Jack Cochrane

    Hi,
    Welcome to the forum!
    Use ROWNUM, like (example):
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL> select rownum, first_name from (select e.first_name from employees e where e.first_name like 'J%' order by e.first_name);
        ROWNUM FIRST_NAME
             1 Jack
             2 James
             3 James
             4 Janette
             5 Jason
             6 Jean
             7 Jennifer
             8 Jennifer
             9 John
            10 John
            11 John
            12 Jonathon
            13 Jose Manuel
            14 Joshua
            15 Julia
            16 Julia
    16 rows selected
    SQL> But rememeber if you want to be sure of unique numbers in certain field is better to use sequences and use seq_name.nextval each time you need.
    Regards,

  • SQLEXEC not able to filter extract on sql statement or function call.

    hi all,
    i'm trying to do some basic extract filtering using a stored function and am not having much success.
    i started off using a procedure call but have been unsuccessful getting that working, i've simplified
    it to use a sql statement calling a function for a value to filter on, but cannot even get that to work.
    i've read through the documentation and i cannot figure out what is going wrong.
    any help would be much appreciated.
    thx,
    daniel
    function code is very simple, just trying to get something working.
    FUNCTION f_lookup_offer_id(v_offer_id IN offer.offer_id%TYPE)
    RETURN company.name%TYPE IS
    lv_company_name company.name%TYPE;
    BEGIN
    SELECT c.name
    INTO lv_company_name
    FROM orders a, offer b, company c
    WHERE a.offer_id = b.offer_id
    AND b.company_id = c.company_id
    AND a.order_id = v_order_id;
    RETURN lv_company_name;
    END f_lookup_offer_id ;
    Oracle GoldenGate Command Interpreter for Oracle
    Version 11.1.1.0.0 Build 078
    Solaris, sparc, 64bit (optimized), Oracle 10 on Jul 28 2010 13:26:39
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    EXTRACT EATUOP1
    INCLUDE ./dirprm/GGS_LOGIN.inc
    EXTTRAIL ./dirdat/up
    DISCARDFILE ./dirout/eatuop1.dsc, append , MEGABYTES 50
    DISCARDROLLOVER ON SUNDAY AT 06:00
    -- Database and DDL Options
    -- Added to avoid errors when setting unused columns
    DBOPTIONS ALLOWUNUSEDCOLUMN
    -- Get full row for deletes
    NOCOMPRESSDELETES
    -- Get updates before
    GETUPDATEBEFORES
    -- If commit SCN that is not greater than the highest SCN already processed error
    THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 15000 IOLATENCY 6000
    -- Retains original timestamp. Currently using GMT
    NOTCPSOURCETIMER
    --TABLE DEFS
    TABLE master.OFFER,
    SQLEXEC ( ID ck_offer,
    QUERY " select master.f_lookup_offer_id(:off_id) is_company from dual ",
    PARAMS (off_id = offer_id),
    BEFOREFILTER),
    FILTER (@GETVAL (ck_offer.is_company = "Google, Inc."));
    does not give any errors, but also does not capture any data, it's filtering everything out and trail files are empty, minus a header.
    thoughts or help?
    2012-04-04 22:17:36 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, eatuop1.prm: EXTRACT EATUOP1 started.
    2012-04-04 22:17:36 INFO OGG-01055 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery initialization completed for target file ./dirdat/up000022, at RBA 978.
    2012-04-04 22:17:36 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Output file ./dirdat/up is using format RELEASE 10.4/11.1.
    2012-04-04 22:17:36 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Rolling over remote file ./dirdat/up000022.
    2012-04-04 22:17:36 INFO OGG-01053 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery completed for target file ./dirdat/up000023, at RBA 978.
    2012-04-04 22:17:36 INFO OGG-01057 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Recovery completed for all targets.
    2012-04-04 22:17:36 INFO OGG-01517 Oracle GoldenGate Capture for Oracle, eatuop1.prm: Position of first record processed Sequence 13469, RBA 21894160, SCN 1789.722275534, Apr 4, 2012 10:12:40 PM.
    -rw-rw-rw- 1 svc_ggs 502 978 Apr 4 22:17 up000023

    got it working, this seems to be about as simple as i could formulate it. thanks for pointing me in the right direction.
    TABLE GGS_TEST_EXT, &
    SQLEXEC ( ID co_count, &
    QUERY " select f_lookup_company_name(:P1) x from dual ", &
    PARAMS ( P1 = company_id), BEFOREFILTER), &
    FILTER ( @GETVAL (co_count.x = 0) );
    then i have a function that returns 1 or 0, depending on the company id passed in.
    thx,
    daniel

  • Issue Related to limit the result in prompt by using SQL statement.

    Hello Gurus,
    I am facing one issue rite now with our testing environment in some Dashboard Prompt. it seems like they are working fine in our Development environment.
    basically I am using SQL statement in prompt to limit the values for current + last 2 years in drop down.
    Here is the SQL that I am using SELECT Time."Fiscal Year" FROM "Financials - AP Overview" where Time."Fiscal Year" <= VALUEOF(NQ_SESSION.CURRENT_FSCL_YEAR) AND Time."Fiscal Year" >= (VALUEOF(NQ_SESSION.CURRENT_FSCL_YEAR)-2) ORDER BY TIme."Fiscal Year" desc
    Now it's working fine in our Dev but geeting failed in Test environment.
    it's giving below error.
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred.
    [nQSError: 43113] Message returned from OBIS.
    [nQSError: 43119] Query Failed:
    [nQSError: 22023] An arithmetic operation is being carried out on a non-numeric type. (HY000)
    SQL Issued: SELECT Time."Fiscal Year" FROM "Financials - AP Overview" where Time."Fiscal Year" <= VALUEOF(NQ_SESSION.CURRENT_FSCL_YEAR) AND Time."Fiscal Year" >= (VALUEOF(NQ_SESSION.CURRENT_FSCL_YEAR)-2) ORDER BY TIme."Fiscal Year" desc
    Please let me know your output.
    Thanking You..

    Couple of possibilities..
    1. environments may be at different patch sets, may be causing the issue.
    2. data in working environment is fine but in other environment.
    to further debug use the same logical sql in both environments and compare the results..
    hope this helps..

  • Join SQL Statement

    Hello all,
    Good day.
    I've one question on how to create the optimal index to support the below JOIN statement.
    SELECT *      
    FROM
         "TABLE1" T_1 INNER JOIN "TABLE2" T_2
         ON T_1.FIELD_JOIN1 = T_2. FIELD_JOIN1 AND
         ON T_1.FIELD_JOIN2 = T_2. FIELD_JOIN2
    WHERE
         T_1.FIELD_WHERE3 and T_1. FIELD_WHERE4 and T_2. FIELD_WHERE5 and T_2. FIELD_WHERE6
    I noticed that in many cases, there will be 2 indexes are created on each table: one index to support the fields in JOIN Condition and the other to support the WHERE Clause.
    My initial thought is to combine the fields in the WHERE clause and JOIN Condition into one secondary index in order to make the index a 'covering index'.
    My proposed indexes:
    Index on TABLE1: MANDT, FIELD_WHERE3, FIELD_WHERE4, FIELD_JOIN1, FIELD_JOIN2
    Index on TABLE2: MANDT, FIELD_WHERE5, FIELD_WHERE6, FIELD_JOIN1, FIELD_JOIN2
    Let say all the fields in the JOIN Condition and WHERE Clause are very selective, is this recommended if we
    1) Create an index which contains the fields for both JOIN condition and WHERE clause?
    2) and the fields of the index will follow the above sequence, meaning the fields in WHERE clause are located at the beginning of the index?
    Thanks,
    KP

    Hi Volker, Hi Harald,
    Thanks for your reply.
    I wrote one SQL statement and tested it in ST05 and the execution plan is as follow.
    - how many rows in MSEG: 36,000,000 
    - how many rows on WHERE MSEG: 4,000  << Smaller
    - how many rows in MKPF: 5,700,000 
    - how many rows on WHERE MKPF: 3,200,000
    --> No of entries after joining the above tables plus the 'where' selection: 62 records
    SELECT
    FROM
      "MKPF" T_00
          INNER JOIN "MSEG" T_01
                ON T_01 . "MANDT" = '100' AND
                       T_00 . "MANDT" = T_01 . "MANDT" AND
                       T_00 . "MBLNR" = T_01 . "MBLNR" AND
                       T_00 . "MJAHR" = T_01 . "MJAHR"                           
    WHERE
          T_00 . "MANDT" = '100' AND
          T_01 . "MATNR" = '000000111216070006' AND
          T_01 . "WERKS" = '1201' AND 
          T_00 . "BUDAT" >= '20090401'
    From the execution plan above, the Outer table is MSEG and Nested Loop Join method is being used. I think correct access plan is used as only 62 records returned.
    SELECT STATEMENT ( Estimated Costs = 19 , Estimated #Rows = 182 )
    5 NESTED LOOPS
              ( Estim. Costs = 19 , Estim. #Rows = 182 )
                Estim. CPU-Costs = 1,646,549 Estim. IO-Costs = 19
    2 TABLE ACCESS BY INDEX ROWID MSEG
                  ( Estim. Costs = 18 , Estim. #Rows = 363 )
                  Estim. CPU-Costs = 412,866 Estim. IO-Costs = 18
    1 INDEX RANGE SCAN MSEG~M
    ( Estim. Costs = 1 , Estim. #Rows = 363 )
    Search Columns: 3
    Estim. CPU-Costs = 23,106 Estim. IO-Costs = 1
    Access Predicates
    4 TABLE ACCESS BY INDEX ROWID MKPF
    Estim. CPU-Costs = 3,399 Estim. IO-Costs = 0
    Filter Predicates
    3 INDEX RANGE Scan MKPF~3
    I think there is a room to further improve the above statement by
    1) Append the fields in the JOIN condition to the index MSEG~M, so the field sequence of this index would be
         MANDT, MATNR , WERKS, MBLNR, MJAHR 
    2) Append the fields (BUDAT) in the WHERE condition to the index MSEG~M, so the field sequence of this index would be
         MANDT, BUDAT, MBLNR, MJAHR      (The distinct number of field BUDAT is 840)
         --> I doubt that whether to put BUDAT at the beginning of the index because operator GE ">=" is used with BUDAT. Do you have any comment on this?
    3) Let's assume BUDAT is used with Equal operator "=", will this field sequence look fine?
        MANDT, BUDAT, MBLNR, MJAHR
    Your comments will be much appreciated. Thank you.
    Best regards,
    KP

  • Precompiled SQL statement at client side ? (JDBC)

    Hi,
    Will Oracle support precompiled SQL statement for jdbc client ?
    Thanks

    A pre-compiled SQL statement on the client side makes absolutely no sense. Let's say the statement refers to system object id 1234 - the EMP table. But in the meantime the EMP table has been dropped and re-created as an index organised table and is now object id 7890.
    What about issues like scope, cost-based optimisation, etc?
    It honestly does not make the slightest sense to even want such a "pre-compiled client SQL" feature.
    > hmm.... Is there anyway to return the compiled SQL
    from database ?
    Yes - that is exactly what a cursor handle is. You give the database a SQL statement. It parses that and returns a SQL (aka cursor) handle for you to use and re-use.
    The typical (stateful) client would use the following template:
    -- open a database connection (usually returns a connection/session handle)
    hConnection = open DBconnection(params)
    -- parse/prepare a SQL statement (returns a SQL/cursor handle)
    hSQL = parseSQL( hConnection, 'INSERT INTO foo VALUES( :0, :1 )' )
    -- reuse the SQL statement
    while (Some_Condition)
    loop
    Some_Processing()
    -- bind values to the SQL statement variables
    SQLBind( hSQL, '0', var1)
    SQLBind( hSQL, '1', var2)
    -- execute the statement (it is not compiled or parsed again by the database)
    ExecSQL( hSQL )
    endloop

  • Toplink generate the SQL statement correctly but it does not return any row

    Hi
    I faced an strange problem when using Toplink as JPA provider. Following snippet shows how I create and execute a query using Toplink JPA:
    q = em.createQuery("SELECT B FROM Branch B WHERE B.street LIKE :street");
    q.setParameter("street", "'%a%'");
       List<Branch> l = q.getResultList();
      System.out.println("List Size: " + l.size());The SQL statement resulted by this query is as follow (according to the generated log file)
    SELECT ID, STREET FROM BRANCH WHERE (STREET LIKE CAST (? AS VARCHAR(32672) ))
      bind => [%a%]Problem is that List size is always 0, independent of what I provide as parameter. I tried and executed the generated SQL statement in the SQL manager and I got some tens of record as the result. The SQL statement i tested in the SQL manager is like:
    SELECT ID, STREET FROM BRANCH WHERE (STREET LIKE CAST ('%a%' AS VARCHAR(32672) ))Can someone please let me know what I am missing and how I can fix this problem?
    Thanks.

    Hi,
    Thank you for reply.
    All data are stored in lower case so, the case sensitivity is not a problem. I am wondering how the generated query works fine when I execute it in the sql manager but it return no result when it is executed by the JPA.
    Thanks for looking into my problem.

  • The number of reloads for the SQL statements

    Hi,
    in 10g R2, how to see the number of reloads for the SQL statements ? Any query ? Which value is high ? Which valu is low ?
    Thanks.

    thanks all.
    It was a test question for 1Z0-042 exam as follows :
    The users on your SALESDB are complaining of slow response to their queries. Using the SQL Tuning Advisor, you determine
    that the SQL statements are using the best optimization plan. Querying the dynamic views, you see that the number of reloads
    for the SQL statements is high, which can cause performance degradation.
    Which component of the SGA should you resize to reduce the number of reloads of the SQL statements?
    Answer :
    shared poolThen I wonder how to see the number of reloads for the SQL ?

  • Update sql statement in sender/receiver jdbc adapter

    Hi
    What is the update sql statement we give in the sender/ receiver adapter when
    1) SELECT statement was written in query sql statement
    2) EXECUTE statement was written for a stored procedure in query sql statement
    thanks
    Anitha

    > 1) SELECT statement was written in query sql statement
    your table should have some value "already_processed" which prevents a second processing of that table.
    the update statement sets that value.
    > 2) EXECUTE statement was written for a stored procedure in query sql statement
    the same as above.
    when your stored procedure already does the update, then write a second stored procedure which does nothing.

  • Standard sql statement v/s parameterized statement

    Are standard sql statements more effiecient that parameterized sql statements (in former case binding happens at compile time and latter at run time?)
    standard sql statement :
    stmt->executeUpdate("INSERT INTO basket_tab
    VALUES(`MANGOES', 3)");
    parameterized sql statment :
    stmt->setSQL("INSERT INTO basket_tab VALUES(:1, :2)");
    stmt->setString(1, "Bananas");
    stmt->setInt(2, 5);
    stmt->executeUpdate();
    Thanks much,
    Nilofer

    Parameterized SQL statements will be far more efficient. When you send a non-parameterized SQL statement to the database, Oracle has to do a hard parse of the statement in order to determine what sort of query plan to use. When the database sees a parameterized SQL statement, though, the parse step is much simpler-- it merely needs to find the previously cached query plan. Using parameterized statements is also much kinder on your shared pool, since you're not filling it up with a bunch of literal SQL statements that will never be reused.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Help needed writing simple PL/SQL statement

    Hi,
    I need to run the following delete statement in a PL/SQL procedure but for it to commit every 1000 rows or so. Can anyone help?
    DELETE
    FROM IDIS.YPROCRULES A
    WHERE 1 = 1
    AND NOT EXISTS (SELECT 'X' FROM IDIS.YPROCCTRL B WHERE A.SEQ_0 = B.SEQ_0)
    Thanks
    Mark

    The fastest most efficient way of doing the delete is to write it in one sql statement as you have done.
    Commiting every 1000 rows means you have to use row by row processing. A lot of us call this slow by slow processing.
    Every time you commit in a loop , you increase the risk of snapshot too old error, plus you actually slow down the processing, as well as give you issues with regards to what happens if your process fails after x iterations. (some of your data is commited, other data is not, how do you restart the process)
    The correct approach is to have appropriately sized rollback/undo segments.

  • How to run a sql statement with bind variable in a test environment

    Hello,
    I have a sql statement in prod that I like to run in test. I got the sql statement from statspack, but the statement has bind variables. How do I get this statement to run in test? Thank you.

    Hi,
    If you have the SQL statement and all the referenced objects are available in your test env then what is the problem to run it?
    If I am not wront to get your reqmnt...
    i.e
    SQL> select * from emp
    where emp_no = &empno
    and dept_code = &deptcode;
    Thanks

  • Preparing Dynamic SQL statement for inserting in Pro*C

    Hi Friends,
    From quite some time i am struggling writing Dynamic SQL statement for dynamic insert and update in Pro*C.
    Can somebody go through my code and suggest me the rigth way of doing.
    Right now it throws an error saying " Error while updating ORA-00904: invalid column name "
    Please help me.
    Girish.
    int main()
    EXEC SQL BEGIN DECLARE SECTION;
    char *uid ="scott/tiger";
    static char sqlstmt[129];
    struct /* DEPT record */
    int dept_num;
    char dept_name[15];
    char location[14];
    } dept_rec;
    EXEC SQL END DECLARE SECTION;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL CONNECT :uid;
    dept_rec.dept_num = 50;
    strcpy(dept_rec.dept_name,"ADMIN");
    strcpy(dept_rec.location,"IN");
    strcpy(sqlstmt,"UPDATE dept set DNAME = dept_rec.dept_name where DEPTNO = dept_rec.dept_num");
    EXEC SQL EXECUTE IMMEDIATE:sqlstmt;
    EXEC SQL COMMIT;
    exit(0);
    void sql_error()
    printf("\nError while updating %s",sqlca.sqlerrm.sqlerrmc);
    EXEC SQL ROLLBACK;
    }

    A bit rusty here but this is how I see it.
    Think of it this way ..
    all Oracle is going to see is:
    UPDATE dept set DNAME = dept_rec.dept_name where DEPTNO = dept_rec.dept_num
    Its NOT going to know what dept_rec.dept_name is or dept_rec.dept_num is ..
    it doesnt go back and fill in those values.
    You need something like
    strcpy(sqlstmt,"UPDATE dept set DNAME = \"");
    strcat(sqlstmt,dept_rec.dept_name);
    strcat(sqlstmt,"\" where DEPTNO = ");
    strcat(sqlstmt,dept_rec.dept_num);
    printf(sqlsmt); # Just to be sure the update statement look right during testing.

  • Transaction or standard program for testing Open SQL statements

    Hi experts,
    Is there a standard program or transaction that can be used to test Open SQL statements?, I was thinking in something similar to a SQL client like sqlcli, but for Open SQL and within SAP GUI.
    I know i can write a test ABAP program for this matter but I rather a standard testing facily in this case
    Thank you for any help
    regards

    Hi Ozcan
    I tried DB02 -> Diagnosis -> SQL Command editor , but I couldn't made it work. It is for Open SQL or for Native SQL?
    I tried the following simple Open SQL statements inside the SQL Code tab there were erros
    SELECT *
    FROM /BI0/PCOMP_CODE
    error was: Incorrect syntax near '/'.
    SELECT * FROM DD03L
    error was: Invalid object name 'DD03L'.
    Where is the mistake?
    regards

Maybe you are looking for

  • Webservice or something like that

    hi my plan: i want to call a apex page from microsoft-word (i know how i do this). the apex page show me a report and when I press on a value in the report (colum with link), the value must be returned to word and the page shoul be closed. how can I

  • How can I import a video directly from a website?

    My daughter was in a news segment from a local TV station that they posted on their website.  I'd like to capture it and save on my Mac.  Can I use iMovie to do this?  If so, how?   If not, how can I capture it?

  • Hello All

    i am using Adobe Reader XI and Adobe Acrobat 8 Standard. i am using the Secure tab>Password Encrypt and i am wondering if i can edit the printings restrictions in order to allow limited printings. Thank you

  • Drawing with animation

    I would like to draw a circle, but have it appear like I am drawing it. Is that possible with Keynote?

  • No password bar to log in what to do?

    No password bar to log in what to do?