[ALL] let's think about Query Language for 2.0

Suros, Juan Juan.Suros at kyocera.com
Fri May 16 09:15:02 CDT 2003


!@#$% Outlook. Here is the complete post I intended to send...


Ruslan,


Here's an example of how this problem is solved in an existing system. In ABAP (script language of SAP R/3) there exists a standardized structure called SELECT-OPTIONS.

	field		type
	-----------	----------------
	SIGN		char(1)
	OPTION	char(2)
	LOW		data dictionary dependant
	HIGH		data dictionary dependant

	SIGN:	can be {I,E} to Include or Exclude an expression
	OPTION: can be {EQ,NE,GT,GE,LT,LE,BT} which are equivalent to (=,!=,>,>=,<,<=,BETWEEN)
	LOW: low value of range (or single value)
	HIGH: high value of range

To use this functionality, I create a range table and fill it with query records:

	RANGES: range_t1 FOR table1-field3.

	range_t1-SIGN1 = 'I'.
	range_t1-OPTION = 'EQ'.
	range_t1-LOW = 'VALUE1'.
	APPEND: range_t1.
	range_t1-SIGN1 = 'E'.
	range_t1-OPTION = 'BT'.
	range_t1-LOW = 'VALUE2'.
	range_t1-HIGH = 'VALUE3'.
	APPEND: range_t1.

This range range_t1 now is the equivalent of the expression "f3 = 'VALUE' AND NOT f3 BETWEEN 'VALUE2' AND 'VALUE3'". In ABAP this query could be used in the following ways:

	SELECT * FROM table1 WHERE f3 IN range_t1.

or

	IF f3 IN range_t1.
		"Do something here
	ENDIF.

This is just an example, I am interested to see what other people suggest.


Juan Suros
Kyocera America, Inc.


More information about the Valentina mailing list