RE: Insert Query

RE: Insert Query

 

  



Just use

insert into RACTUSER.RACT_CUSTOMER_MST_1 (RELATIONSHIP_NUMBER,
LOAN_ACCOUNT_NO, CUST_NAME, PRODUCT_CODE, ADDRESS1,
ADDRESS2, ADDRESS3, ADDRESS4, CITY )
select RELATIONSHIP_NUMBER, LOAN_ACCOUNT_NO, LAST_NAME, PRODUCT_CODE,
ADDRESS1, ADDRESS2, ADDRESS3,
ADDRESS4, CITY FROM RACTUSER.RACT_CUSTOMER_MST
WHERE RELATIONSHIP_NUMBER='AAAAAAAAAAAAAAAAAAA'

No VALUES ...
Keep in mind in case selct does not return any row 02000 error is
raised.


Thanks & Regards,

Aniruddha Gupta

( +91-22-40187851

( +91-22-55597851

-----Original Message-----
From: rekha
[mailto:db2udbdba-ezmlmshield-x4056510.[Email address protected]
Sent: Friday, July 28, 2006 1:56 PM
To: LazyDBA Discussion
Subject: Insert Query

While executing the following command (to insert records from old table
to
new table)

------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
----------------
insert into RACTUSER.RACT_CUSTOMER_MST_1 (RELATIONSHIP_NUMBER,
LOAN_ACCOUNT_NO, CUST_NAME, PRODUCT_CODE, ADDRESS1,
ADDRESS2, ADDRESS3, ADDRESS4, CITY )
VALUES
(select RELATIONSHIP_NUMBER, LOAN_ACCOUNT_NO, LAST_NAME, PRODUCT_CODE,
ADDRESS1, ADDRESS2, ADDRESS3,
ADDRESS4, CITY FROM RACTUSER.RACT_CUSTOMER_MST
WHERE RELATIONSHIP_NUMBER='AAAAAAAAAAAAAAAAAAA')

getting an error
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
----------------
SQL0412N Multiple columns are returned from a subquery that is
allowed only one column.

Explanation:

In the context of the SQL statement, a fullselect is specified
that can have only one column as a result.


Can anybody help me on this?

Regards,
Rekha
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you




---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



DISCLAIMER:
This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.

DB2 & UDB email list listserv db2-l LazyDBA home page