View Single Post
 
Old July 1st, 2010, 10:47 AM
vinod_pawar1 vinod_pawar1 is offline
Authorized User
 
Join Date: Jun 2004
Location: Aurangabad, Maharashtra, India.
Posts: 54
Thanks: 0
Thanked 1 Time in 1 Post
Default How to insert values from Variable and table in single query

Hello All,

I am stuck with a problem. Could somebody show me as to how to accomplish following thing in Oracle 10g?

I need to insert 4 different claim number from a table along with a constant value from variable.

for example:

'some value', 123456
'some value', 223344
'some value', 555555
'some value', 123457

Possible Solution:
=================

DECLARE
XCONST VARCHAR2(20);
BEGIN
XCONST:= 'some value';
INSERT INTO A_TABLE(SOME_VALUE, CLAIMNUMBER)
SELECT (SELECT XTEST FROM DUAL), CLAIMNUMBER FROM TBLVOUCHERS WHERE ROWNUM <=4;
END;

Also I would want to avoid using any loop or cursor here. Is it possible?

Thank in Advance
Vinod
__________________
Vinod Pawar
United States