Results 1 to 5 of 5
  1. #1
    NandiniGarg is offline Member
    Join Date
    Nov 2010
    Posts
    3
    Rep Power
    0

    Default dynamic insert query statement

    I have to insert 5 column value into the table from which 4 column values comes in one table and other one is dynamic value. I am using the below insert statement but it takes dynamic value null ?

    insert into weekly_plan(SHIFT_ID,ASSOCIATE_ID,ADDRESS_ID,LOCAL ITY_ID,SUB_LOCALITY_ID,WEEK_DAY)
    (SELECT LOGIN_SHIFT_ID,AP.ASSOCIATE_ID,LOGIN_ADDRESS_ID,AD R.LOCALITY_ID,ADR.SUB_LOCALITY_ID,@enterDay
    FROM ASSOCIATE_PLAN AP,ASSOCIATE_ADDRESS ADR WHERE AP.ASSOCIATE_ID=ADR.ASSOCIATE_ID AND AP.LOGIN_ADDRESS_ID=ADR.ADDRESS_ID);

  2. #2
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default

    What database and version are you using?


    EDIT: also, Please use code tags, [CODE][/CODE]
    Last edited by mine0926; 12-09-2010 at 07:22 AM.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,846
    Rep Power
    19

    Default

    How are you calling this SQL?
    This is a Java forum, so presumably there's some Java behind this somewhere.

  4. #4
    NandiniGarg is offline Member
    Join Date
    Nov 2010
    Posts
    3
    Rep Power
    0

    Default

    i m calling this through stored procedure .

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,846
    Rep Power
    19

    Default

    Right.
    So what are you passing into the stored procedure for @enterDay?
    Because that appears to be null.

    In other words it's unlikely to be the above SQL, but more likely to be the Java code calling it.

Similar Threads

  1. General Insert statement to DB
    By avisik in forum JDBC
    Replies: 1
    Last Post: 11-29-2010, 08:10 AM
  2. Replies: 1
    Last Post: 05-20-2010, 07:58 AM
  3. Dynamic element in a statement
    By pjeremypj in forum New To Java
    Replies: 2
    Last Post: 12-09-2009, 10:01 AM
  4. insert query in odbc
    By lipun4u in forum Advanced Java
    Replies: 3
    Last Post: 07-21-2009, 09:14 AM
  5. Replies: 3
    Last Post: 02-28-2009, 09:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •