Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sql select

hello all,

can you tell if the syntax of the function below is correct ?

Normally i must have in the variable (gvNoOfRowsLastLoad ) at least 1 line  but apparently i retrieve nothing in the database.

when i execute the request in the database i have a data.



LET pSQLWhereClause = 'WHERE DATE_APPLI = To_Date(' & CHR(39) & Date(Date#($(LVDateModif),'YYYYMMDD'),'MM/DD/YYYY') & CHR(39) & ',' & CHR(39) & 'MM/DD/YYYY' & CHR(39) & ') ';

sub SrcLoad_LISTE_DATE_APPLI (pSQLTableName,pSQLWhereClause )

  LET gvNoOfRowsLastLoad = 0 ;

  // Load the QVD Table from the SQL table

  LISTE_DATE_APPLI_MODIFIED:

  LOAD DATE_APPLI; SQL SELECT  DATE_APPLI FROM $(gvDBOwner).$(pSQLTableName) $(pSQLWhereClause);

  LET gvNoOfRowsLastLoad = NoOfRows('LISTE_DATE_APPLI_MODIFIED')  ;

  Trace gvNoOfRowsLastLoad : $(gvNoOfRowsLastLoad) ;

  for vRow = 0 to NoOfRows('LISTE_DATE_APPLI_MODIFIED')

  Let MyVar = Peek('DATE_APPLI',vRow-1,'LISTE_DATE_APPLI_MODIFIED');

  CALL srLoad_M2R_DTM_ACKTRANSACTION_INCR( pSQLTableName, MyVar) ;

  next

end sub

Can you help please ?

Regards

5 Replies
Gysbert_Wassenaar

Check the content of the variables you use. Does LVDateModif have a value? Does pSQLWhereClause get a correct value?


talk is cheap, supply exceeds demand
Not applicable
Author

yes LVDateModif ='20160810' and yes pSQLWhereClause  get WHERE DATE_APPLI = To_Date(' & CHR(39) & Date(Date#($(LVDateModif),'YYYYMMDD'),'MM/DD/YYYY') & CHR(39) & ',' & CHR(39) & 'MM/DD/YYYY' & CHR(39) & ')

Gysbert_Wassenaar

Well, if pSQLWhereClause resolves to pSQLWhereClause = 'WHERE DATE_APPLI = To_Date(' & CHR(39) & Date(Date#($(LVDateModif),'YYYYMMDD'),'MM/DD/YYYY') & CHR(39) & ',' & CHR(39) & 'MM/DD/YYYY' & CHR(39) & ') ' I'm not suprised your SQL database doesn't understand it. It should resolve to something like WHERE DATE_APPLI = To_Date('08/10/2016', 'MM/DD/YYY'),


talk is cheap, supply exceeds demand
Not applicable
Author

that's what i get that means i get    --> WHERE DATE_APPLI = ToDate('08/10/2016', 'MM/DD/YYY')

Gysbert_Wassenaar

Then you have to correct where clause. If your database doesn't like it then you have to figure out what the correct syntax for a where clause is.


talk is cheap, supply exceeds demand