SQL Syntax Error SQL0104

295 pts.
SQL error messages
SQL statements
Syntax errors
I have to recreate a duplicate logical file, but I can't use the crtdupobj command because it doesn't recreate the correct library pointers. Using the dspfd command. I'm attempting to recreate the logical file in a different environment(library). Using the exact same commands (different library) I'm attempting to create the file in SQL using the example below. When I do I continue to get error SQL0104 which from what I've read says it's a syntax error. Can someone please assist me in correcting the syntax below? It's not clear to me where the error is. Thank You
V5R4M0 060210 Run SQL Statements INQHISTZ 05/25/10 11:07:14 Page 2
Record *...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 SEQNBR Last change
1 create view inqhistz as
2 select h.dcord#, h.dcodat, h.dcbcus, i.ddpart, h.dcscus, h.dcpo
3 cast(max(ifnull(ext.cost,0)) as decimal(11,2) as stdcost
4 cast(max(ifnull(ddunpr,0)) as decimal(12,3)) as ddunpr
5 cast(sum(ddqtoi) as decimal(12,3)) as ddqtoi
6 cast(sum(ddqtsi) as decimal(12,3)) as ddqtsi
7 char(dcodat) as dcodt6, char(dcodat,usa) as dcod10
8 char(dcodat) as dcod08, char(dcodat,iso) as dcodst
9 from csaldat.ocrh h inner join csaldat.ocri i on h.dcord# = i.ddord# +
10 inner join csaldat.cust c on h.dcbcus=c.bvcust +
11 inner join csallib.itemmast s on i.ddpart = s.part left join +
12 csaldat alsordext ext on i.ddord# = ext.ordno and i.dditm# = ext.line +
13 where i.ddglc not like ’SC%’
14 group by h.dcord#, h.dcodat, h.dcbcus, i.ddpart, h.dcscus, h.dcpo;
* * * * * E N D O F S O U R C E * * * * *
SQL0104 30 3 Position 7 Token ( was not valid. Valid tokens: , FROM
Message Summary
Total Info Warning Error Severe Terminal
1 0 0 0 1 0
30 level severity errors found in source
* * * * * E N D O F L I S T I N G * * * * *

Software/Hardware used:

Answer Wiki

Thanks. We'll let you know when a new response is added.

A right parenthesis is missing in line 3:

<pre>3 cast(max(ifnull(ext.cost,0)) as decimal(11,2)<b>)</b> as stdcost</pre>

Commas <b>could be</b> missing at the end of lines 3-7


As noted above, commas do seem to be missing between many of the column definitions. It <i>appears</i> as if commas should be at the ends of lines 2 through 7. And there are plus (“+”) signs at the ends of lines 9 through 12 that shouldn’t be there.

When you post code, please select the lines and click the “code” button in order to preserve the exact characters that you pasted. If you get another error, also include the exact text of the error message. The original message showed line 3 position 7 as the point of error, but we can’t tell if the code in the question was altered by the editor when you pasted it. If a new error appears, we will need to see that too.


Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • DLM2007
    Good catch, but not luck. I added the right parenthesis and added commas after lines 3 to 7 with the exact same error message. Any other suggestions? Thank You, DLM
    295 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: