LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  DB Execute node

    Employee
    Posted 10-15-2015 15:24

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dhrobertson

    Hi there

    could someone tell me how I can go about do the following?

    lets say I have a table of 50 rows with 4 columns: a,b,c,d

    I want to insert these 50 rows into an oracle database table called table1 with column names a,b,c,d using the DB Execute node.

    what syntax do I use to do this for multiple columns?

    for a single column this seems to work

    SQLNonSelect("insert table1 set a = :1", 'a')
    but how can I insert multiple columns at once.

    then, to update said table....

    how do I update the table based on looking up records that may have changed?

    there seems to be very limited information on how to use sqlselect and sqlnonselect statements so am blundering around in the dark a bit.

    thanks

    douglas


  • 2.  RE: DB Execute node

    Employee
    Posted 10-16-2015 07:35

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    sqlSelect is for the Select statement only.. sqlNonSelect is for all other database operations.

    Yes, most of the examples show just one field, but you can put any number of fields into the INSERT command:

    query=”INSERT INTO tablename (a,b,c,d) VALUES (:1,:2,:3,:4......)”
    sqlNonSelect(query,myfield1,myfield2,myfield3,myfi eld4.....)

    However, using DBExecute, you must list all the fields yourself, you can’t do a “generic” version.
    If you want to avoid listing all the fields, you’d use the DBStore node.