| khubeb |
Posted: Jun 26, 2008 06:32:54 AM |
Total Post: 108
Joined: Apr, 2007
|
UPDATE T_LOC SET address_desc = (SELECT ap_locn FROM T_ACPT,t_str where t_str.ST_TRMNL_ID=t_acpt.AP_ID and t_str.ST_TRMNL_ID is not null)
01427 single qry return multile rows. |
|
|
shake |
| Posted: Jun 26, 2008 06:47:50 AM | |
|
Total Post: 84
Joined: Jun, 2008
|
Your SELECT surely returns multiple records. It is not possible to assign all these (record values) addresses into the SET condition. In your SET address_desc, you can obviously set a single address description of varchar2 of any length but not multiple records.
Try differently:
UPDATE T_LOC SET address_desc = (SELECT ap_locn FROM T_ACPT, t_str where t_str.ST_TRMNL_ID=t_acpt.AP_ID and t_str.ST_TRMNL_ID is not null AND t_str.ST_TRMNL_ID = <a particular value>);
|
|
|
|
|
khubeb |
| Posted: Jun 26, 2008 06:52:38 AM | |
|
Total Post: 108
Joined: Apr, 2007
|
there are so may st_trmnl_id we cant asign it..
plz chk it
update t_loc set address_desc=(select ap_locn from t_acpt) where location_code=(select location_code from t_Str where st_trmnl_id is not null)..
same error
we have to update thousand of rows plz me send soln...
|
|
|
|
|
shake |
| Posted: Jun 26, 2008 07:24:47 AM | |
|
Total Post: 84
Joined: Jun, 2008
|
You can update any no. of records with the new values. It's not an issue. But you must be very clear about the criteria which bring the changes. I mean that you give UPDATE with WHERE clause too to effect the changes on particular records. If you dont, all records of your table get updated.
Another thing is you cannot try to place multiple addresses in a condition as you have given.
Try this:
UPDATE T_LOC SET address_desc = 'Bangalore' WHERE T_LOC.f1 = v1;
f1 -> field1
v1 -> value1
If it works fine, replace the string 'Bangalore' with your own condition which returns a single value of address description.
|
|
|
|
|
shake |
| Posted: Jul 03, 2008 02:57:18 AM | |
|
Total Post: 84
Joined: Jun, 2008
|
Try this:
select count(location_code) from t_Str where st_trmnl_id is not null
This query will definitely return count value more than 1. If it returns exactly 1, it would work.
The problem is both of your subqueries return MULTIPLE records. Plz understand the problem and change the query which should return a single record(only one row).
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |