This article is now available in our new knowledge base: IBM i DB2 SQL results are unexpected, research using Navigator
Issue
SQL statements running in a PHP script are not producing the expected result. Using the db2_statement_error() and db2_statement_errormsg() functions can help, but it would be nice to be able to quickly make changes to the SQL statement and see a result.
Environment
Any version of Zend Server for IBM i running on any version of IBM i. User workstation has IBM i Access installed.
Resolution
Please try testing your SQL statement in Navigator. You can basically run the statement as you have it in your script, just substitute some valid values for the question marks and/or variables. Remember to end each SQL statement with a semicolon.
In Navigator, find Databases and expand it. Right below Databases, there should be a data base for your IBM i. Right click the data base, and select 'Run SQL Scripts'. A new window will appear that allows you to run any SQL statements, and provides output and error reporting. You can learn more about how to use this utility here:
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzatc/rzatcrunscript.htm
Comments