Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

PL/SQL Update question

Hello all,  

I need to run an update does the following:

I have a query that does the following:
SELECT '250 MA' AS FACILITY, '4th' AS FLOOR, NL.*, NL2.* FROM CONV_NAMS_LOCATION NL
LEFT JOIN CONV_NAMS_LOCATION NL2 ON NL.NAMS_ID = NL2.NAMS_PARENT_ID
WHERE NL.NAMS_PARENT_ID = 247

Result Set looks like this as an example:
FACILITY, FLOOR, LOCATION, NAMS_ID, NAMS_PARENT_ID, LOCATION_1, NAMS_ID_1, NAMS_PARENT_ID_1

250 MA      4th      4C-200      248      247      A      593      248
250 MA      4th      4C-205      249      247      A      600      249

I then need to update a table called CONV_MAP_LOCATION that looks like this:
FACILITY,  FLOOR_NAME, ROOM_NAME, RACK_NAME, NAMS_ID

I need to update the NAMS_ID in the CONV_MAP_LOCATION table to the NAMS_ID_1 field from the sub query above where the FACILITY = FACILITY, FLOOR = FLOOR_NAME,  ROOM_NAME = LOCATION, RACK_NAME = LOCATION_1
Avatar of MikeOM_DBA
MikeOM_DBA
Flag of United States of America image

And?
What is preventing you from doing it?
:p
Avatar of sbornstein2
sbornstein2

ASKER

confused if I suppose to join the subquery or use a Where clause outside it etc.
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This was perfect and what I have been looking for.  Thanks again huge help