Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / May 2006

Tip: Looking for answers? Try searching our database.

HELP !!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
eap90210 - 22 May 2006 17:13 GMT
Hi to all ng

(sorry for my bad english)

I have a problem. in a "c" progam I write an dynamic sql that in run-time
give me an error sqlcode = -104 SQLSTATE[42601].
I read in a document (Message Reference ) that come to aid that read a
sqllerm. Infact the sqlerrm told you at what point the token should be ok.
So I modify my program but the print out of sqlerrm does not help me.
Probably I don't keep the right piece, because i don't know the struct of
sqlca.
So I try to print-out an sql in a log file, and I execute directly in clp.
in thi s case work!!
so the sql is here
"insert into inventari_det (
       NVD_NVT_NUMERO_DOCUMENTO , NVD_NUMERO_RIGA       ,
       NVD_UBI_LOC_LOCALITA_1   , NVD_UBI_UBICAZIONE_1  ,
       NVD_PRIMO_LIVELLO_1      , NVD_SECONDO_LIVELLO_1 ,
       NVD_TERZO_LIVELLO_1      , NVD_QUARTO_LIVELLO_1  ,
       NVD_ANA_TIPO_ANAGRAFICA  , NVD_ANA_CODICE_SAP    ,
       NVD_STATO_MATERIALE      , NVD_TIPO_MATERIALE    ,
       NVD_TRZ_TIPO_TERZO       , NVD_TRZ_CODICE_TERZO  ,
       NVD_RDA                  , NVD_SERIAL_NUMBER_1   ,
       NVD_QUANTITA_1           , NVD_GST_PROGRESSIVO_INTERNO  ,
       NVD_ORDINE_USCITA_1      , NVD_RIGA_ORDINE_USCITA_1     ,
       NVD_ETICHETTA_1          , NVD_GERARCHIA         ,
       NVD_GST_GST_PROGRESSIVO_INT, NVD_DATA_CREAZIONE  ,
       NVD_UTENTE_CREAZIONE
 ) select   65 , row_number() over() ,
       DWH_MAG_UBI_LOC_LOCALITA , DWH_MAG_UBI_UBICAZIONE ,
       DWH_MAG_PRIMO_LIVELLO    , DWH_MAG_SECONDO_LIVELLO,
       DWH_MAG_TERZO_LIVELLO    , DWH_MAG_QUARTO_LIVELLO ,
       DWH_ANA_TIPO_ANAGRAFICA  , DWH_ANA_CODICE_SAP     ,
       DWH_STATO_PALLET         , DWH_TIPO_STOCK         ,
       DWH_TRZ_TIPO_TERZO       , DWH_TRZ_CODICE_TERZO   ,
       DWH_RIFERIMENTO_RDA      , DWH_SERIAL_NUMBER      ,
       DWH_QUANTITA             , DWH_PROGRESSIVO_INTERNO,
       DWH_NUMERO_ORDINE        , DWH_NUMERO_RIGA        ,
       DWH_NUMERO_ETICHETTA     , DWH_GERARCHIA          ,
       DWH_GST_PROGRESSIVO_INTERNO, current date         ,
 'InvCreaDet'
 from dwh_stock x
  where  DWH_ANA_TIPO_ANAGRAFICA in ( substr( 'F' ,  posstr( 'F' , '-' ) +
1  )   , substr( 'F' ,  posstr( 'F' , '-' ) + 1  ) ) AND
DWH_MAG_UBI_LOC_LOCALITA in ( substr( 'WF1' ,  posstr( 'WF1' , '-' ) + 1  )
, substr( 'WF1' ,  posstr( 'WF1' , '-' ) + 1  ) ) AND
DWH_MAG_UBI_UBICAZIONE in ( substr( 'WF1-SAM1' ,  posstr( 'WF1-SAM1' ,
'-' ) + 1  )   , substr( 'WF1-SAM1' ,  posstr( 'WF1-SAM1' , '-' ) + 1  ) )
AND
DWH_NVT_NUMERO_DOCUMENTO is null
AND DWH_DATA_REGISTRAZIONE <= date('05/22/2006')
 and DWH_DATA_REGISTRAZIONE = ( select max(a.DWH_DATA_REGISTRAZIONE)
                from dwh_stock a where a.DWH_DATA_REGISTRAZIONE <=
date('05/22/2006')
                and x.DWH_PROGRESSIVO_INTERNO = a.DWH_PROGRESSIVO_INTERNO)
"

SOMEONE SEE the error ??? Suggest me another way to solve this problem I
pray you !!!

thaks in advance

regards
sergio
Serge Rielau - 22 May 2006 23:37 GMT
> Hi to all ng
>
[quoted text clipped - 55 lines]
> SOMEONE SEE the error ??? Suggest me another way to solve this problem I
> pray you !!!
Just run the statement from the command line or the GUI to get the token.
You got yourself a syntax error. Probably a missing bracket or so...
If all fails: Divide and conquer...
Cheers
Serge
Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

eap90210 - 23 May 2006 10:08 GMT
Best thanks for answer me.

I try to execute the insert but I have not error. For exeute this insert I
write in a file mm.sql and I issue by (db server platform is unix aix)
$ db2 -f mm.sql -t

Any error !! I don't understand !!

Is possible that the dynamic sql that is long major tha 2000 char have a
problem ?
Other thing what does it mean conquer ?

Best regards
sergio

>> Hi to all ng
>>
[quoted text clipped - 62 lines]
> Cheers
> Serge
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.