sikyala
asked on
query works but insert doesn't how do i fix it
when i do a select I get 1 row returned.
select * from holdings where SITE = 'TAT' AND DB_INSERTED > to_date('03-NOV-11','DD-MO N-RR') AND NOT EXISTS (SELECT holding_id from WS_RECORD ws WHERE HOLDINGS.ID = HOLDING_ID);
But when I try to insert that row into another table I get an error
INSERT INTO WS_RECORD (HOLDING_ID, TITLE) SELECT ID, TITLE FROM HOLDINGS BH WHERE SITE = 'TAT' AND DB_INSERTED > to_date('03-NOV-11','DD-MO N-RR') AND NOT EXISTS (SELECT holding_id from WS_STI_RECORD where HOLDINGS.ID =
HOLDING_ID);
When I run this, I get the following error:
SQL Error: ORA-00904: "HOLDINGS"."ID": invalid identifier
00904. 00000 - "%s: invalid identifier"
If I include the holdings table in my subquery at the end
(SELECT holding_id from WS_RECORD ws, HOLDINGS bh where bh.ID =
ws.HOLDING_ID);
I get no rows returned. How do i change the insert so that it inserts the same record I get for my select statement?
select * from holdings where SITE = 'TAT' AND DB_INSERTED > to_date('03-NOV-11','DD-MO
But when I try to insert that row into another table I get an error
INSERT INTO WS_RECORD (HOLDING_ID, TITLE) SELECT ID, TITLE FROM HOLDINGS BH WHERE SITE = 'TAT' AND DB_INSERTED > to_date('03-NOV-11','DD-MO
HOLDING_ID);
When I run this, I get the following error:
SQL Error: ORA-00904: "HOLDINGS"."ID": invalid identifier
00904. 00000 - "%s: invalid identifier"
If I include the holdings table in my subquery at the end
(SELECT holding_id from WS_RECORD ws, HOLDINGS bh where bh.ID =
ws.HOLDING_ID);
I get no rows returned. How do i change the insert so that it inserts the same record I get for my select statement?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER