DB2-SQL Errors -300,-301,-302,-303,-304

I am just listening to Mind music and relaxing with it (a great CD-like body exercise, we also need some exercise for our mind. This CD will do it. It is not an expensive one. I amazed by listening the quality of it).

Recently, I found some errors, while writing SQL query.

Writing a SQL query(DB2) is a major part of work. If it is successful, your work is almost completed.

Let me give an example:

Select Digits(Bill_TAX_1)
    into :WS-BILL-TAX
from A_Table A INNER JOIN B_Table B
ON A.Invoice_id = B.Invoice-id
Where A.Cust_Name = ‘Test1’
  AND B.Bill_Number = ‘180000’

Here, :WS-BILL-TAX ===> Output host variable
      :WS-Bill-date ===> Input host variable

Data-types of these input/output host variables  must  match to the table column data types ( char to char, integer to numeric, comp to comp etc), else, you will get these kind of errors.

The errors -300,-301, -302, -303,-304 usually occur with host-variable related issues.

DB2 10 SQL error codes with reasons

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.