← All errors

SQLCODE -304

SQL0304 Conversion error assigning to a variable

IBM message text
Conversion error in assignment to variable &2.
SQLCODE
-304
SQLSTATE
22003, 22023, 22504

Most common cause

The returned value does not fit in the variable: typical with SUM or COUNT into variables sized too small.

Other causes

  • Invalid decimal data in the table (packed fields holding blanks in DDS files).

How to fix it

Make the variable larger, or use a CAST in the query. If the problem is bad data, fix it at the source.

Related errors

Text and codes from IBM documentation for 7.6. Checked on .