Hi friends,
how can I receive character data from ORACLE-Interface, there is a problem receiving data:
NAT0748 Error during conversion of property value or return value
the Problem statement is
SEND “VALUE” TO O-FIELD
RETURN #ORA-VALUE
with #ORA-VALUE (A01) or (A)dynamic
I am receiving character or alphanum. data, this is confessed with
SEND “TYPE” TO O-FIELD
RETURN #ORA-TYPE
giving #ORA-TYPE = ‘10’
I’ve tested on Natural for Windows 6.3.14 and older
and I’m grateful receiving some help :?
commented code example:
DEFINE DATA
LOCAL
01 O-RECORDSET HANDLE OF OBJECT
01 O-RECORD HANDLE OF OBJECT
01 O-FIELD HANDLE OF OBJECT
01 O-DATABASE HANDLE OF OBJECT
01 #SQL-STATEMENT (A253)
01 #OPTIONS (I04)
01 #SNAPSHOT (A253)
01 #FIELDCNTR (I04)
01 #FIELDIND (I04)
01 #RECIND (I04)
01 #ORA-TYPE (A)DYNAMIC
01 #ORA-VALUE-A (A)DYNAMIC
01 #ORA-VALUE-1 (A1)
01 #ORA-NAME (A)DYNAMIC
01 #DATE (D)
01 #ORA-SIZE (I4)
01 #STRING-VAL (A100)
01 REDEFINE #STRING-VAL
02 #STRING-VAL/1 (A1)
01 #STRING-VAL-NEW (A100)
01 REDEFINE #STRING-VAL-NEW
02 #STRING-VAL-NEW/1 (A1)
02 #STRING-VAL-NEW/99(A99)
01 A-FIELD-NAME (A100)
01 A-FIELD-TYPE (A1)
01 A-DATA (A100)
END-DEFINE
* ...
SEND "CREATEDYNASET" TO O-DATABASE
WITH #SQL-STATEMENT #OPTIONS #SNAPSHOT
RETURN O-RECORDSET
* ...
SEND "ITEM" TO O-RECORD /* no problem
WITH #FIELDIND
RETURN O-FIELD
SEND "TYPE" TO O-FIELD /* no problem
RETURN #ORA-TYPE
SEND "NAME" TO O-FIELD /* no problem
RETURN #ORA-NAME
PRINT #ORA-TYPE #ORA-NAME
A-FIELD-NAME := #ORA-NAME
DECIDE ON FIRST VALUE OF #ORA-TYPE
VALUE '3', '4', '7'
A-FIELD-TYPE := "N"
SEND "VALUE" TO O-FIELD /* no problem
RETURN #STRING-VAL
IF #STRING-VAL/1 = ','
/* at numeric value < 1 leading zero is lost
RESET #STRING-VAL-NEW
#STRING-VAL-NEW/1 := 0
#STRING-VAL-NEW/99 := #STRING-VAL
A-DATA := #STRING-VAL-NEW
ELSE
A-DATA := #STRING-VAL
END-IF
VALUE '8'
SEND "VALUE" TO O-FIELD /* no problem
RETURN #DATE
A-FIELD-TYPE := "D"
MOVE EDITED #DATE (EM=DD.MM.YYYY) TO A-DATA
VALUE '10'
SEND "SIZE" TO O-FIELD /* no problem
RETURN #ORA-SIZE
IF #ORA-SIZE = 1
SEND "VALUE" TO O-FIELD /* <-- Error NAT0748
RETURN #ORA-VALUE-1
A-DATA := #ORA-VALUE-1
ELSE
SEND "VALUE" TO O-FIELD /* <-- Error NAT0748
RETURN #ORA-VALUE-A
A-DATA := #ORA-VALUE-A
END-IF
A-FIELD-TYPE := "A"
NONE VALUE
IGNORE
END-DECIDE
PRINT 'Value:' A-DATA
END