2m.lt
New Member
The reason of using it is the following:
I have a table in an Oracle DB. This table has indexed customer_id CHAR(20) field. The problem is writing queries using these CHAR fields.
For example the following three statements do not return anything:
FOR EACH phone WHERE customer_id = "1" NO-LOCK: DISP phone.customer_id.
END.
FOR EACH phone WHERE customer_id = "1 " NO-LOCK:
DISP phone.customer_id.
END.
SELECT customer_id FROM phone WHERE customer_id = "1".
It seems progress trims strings in the WHERE condition, so no results are returned. However this statement returns two rows, which is the correct behavior:
SELECT customer_id FROM phone WHERE customer_id = "1 ".
This is why I wanted to put SQL SELECT statement results to temp-table.
Well, for now I think I will use stored procedure to get the same effect:
RUN STORED-PROC send-sql-statement LOAD-RESULT-INTO bufHandle (SUBST("
SELECT customer_id FROM phone
WHERE customer_id = '&1'
", customerId)).
Notice that I do not need to use padding when executing queries straight in the Oracle DB server, which is of course how you would normally write SQL queries which use CHAR field.
I have a table in an Oracle DB. This table has indexed customer_id CHAR(20) field. The problem is writing queries using these CHAR fields.
For example the following three statements do not return anything:
FOR EACH phone WHERE customer_id = "1" NO-LOCK: DISP phone.customer_id.
END.
FOR EACH phone WHERE customer_id = "1 " NO-LOCK:
DISP phone.customer_id.
END.
SELECT customer_id FROM phone WHERE customer_id = "1".
It seems progress trims strings in the WHERE condition, so no results are returned. However this statement returns two rows, which is the correct behavior:
SELECT customer_id FROM phone WHERE customer_id = "1 ".
This is why I wanted to put SQL SELECT statement results to temp-table.
Well, for now I think I will use stored procedure to get the same effect:
RUN STORED-PROC send-sql-statement LOAD-RESULT-INTO bufHandle (SUBST("
SELECT customer_id FROM phone
WHERE customer_id = '&1'
", customerId)).
Notice that I do not need to use padding when executing queries straight in the Oracle DB server, which is of course how you would normally write SQL queries which use CHAR field.