SPL1027:E(L62), Missing/Invalid SQL statement'E(3707):Syntax error, expected something like an 'IN' keyword between ')' and '|'

I came across this error the other day while creating a stored procedure in Teradata.  In my stored procedure I had a create table as statement with an SQL select statement followed by two SQL delete statements in the body of the procedure.

The way SQL Delete statements were written was the cause of the problem.  Specifically, the way you say not equal to.  In SQL you can say 'not equal to' by typing != or <>.  The Teradata stored procedure preferred the latter, <>.

For example if in your stored procedure you have:

 

DELETE FROM DB_PROD.FDASGN

WHERE TRIM(ASGNTYP) = 'WT02'

AND ((TRIM(TCODE) != 133 OR TCODE <> 165)

AND (TRIM(REASON) != 'A56'));

 

You should replace the not equal to (!=) signs to this (<>)
 

DELETE FROM DB_PROD.FDASGN

WHERE TRIM(ASGNTYP) = 'WT02'

AND ((TRIM(TCODE) <> 133 OR TCODE <> 165)

AND (TRIM(REASON) <> 'A56'));

Thanks for reading. 

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <strike> <caption>

More information about formatting options