ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Ignoring rows that produce errors

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ignoring rows that produce errors

    How can I get my SQL to ignore this error. It seems that ORSLSM contains some rows that contain non numeric values. I would like to ignore the row that are causing the errors

    Click image for larger version

Name:	image.png
Views:	81
Size:	4.2 KB
ID:	159438

  • #2
    If orstat and/or orcoto are not numeric fields, I would say they couse the error.
    In that case you can just write your WHERE like ... WHERE ORSTAT >= '6'

    Otherwise you can skip the rows by using regex:

    WHERE regexp_count(TRIM(ORSLSM), '^[0-9]*$') = 1

    This checks if the field contains only numeric values.

    Hope this helps
    Andy

    Comment


    • #3
      Then your query doesn't make sense, because digits() converts a number to a string. If ORSLSM is a number, it should only contain valid data unless the underlying hex value bas been incorrectly modified outside of normal file IO. Can you confirm the data type of ORSLSM?

      Comment

      Working...
      X