Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Left Function in code

Status
Not open for further replies.
Aug 22, 2003
20
US
I am trying to update a field one table with a field value in another table. The problem I have is the length of the field I am trying to update is shorter than the length of the field I am trying to update it to. I do not want to change the field lengths so I tried using the LEFT function in the update code. See Below:

Code:
UPDATE DOCSADD SET DOCSADD.RET_ADDR1 = (SELECT LEFT(SETDATA.ADDRESS,35) FROM SETDATA WHERE SETDATA.TYPE = '3' AND SETDATA.AP_NUM = DOCSADD.AP_NUM)

The following error comes back:

Error number: -904, position:0-
ORA-00904: invalid column name

What am I doing wrong??
 
Hi,
LEFT is not an Oracle SqlPlus function.

Use Subtstr instead:

Code:
UPDATE DOCSADD
 SET DOCSADD.RET_ADDR1 = (SELECT SUBSTR(SETDATA.ADDRESS,1,35) FROM SETDATA WHERE SETDATA.TYPE = '3' AND SETDATA.AP_NUM = DOCSADD.AP_NUM)


Hope it helps...
[profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top