User Tools

Site Tools


runtime_sql_properties_for_views_using_sql_drivers.htm
Navigation:  SQL Drivers >====== Runtime SQL Properties for Views ====== Previous pageReturn to chapter overviewNext page

The SQL View Engine allows you to specify SQL that will be substituted for a column in a SELECT statement using the following syntax:

view{'field_label',PROP:Name} = SQLString

where SQLString is any SQL valid within a SELECT statement.

Example:

 PROGRAM

 MAP

 END

EMP       FILE,DRIVER('ORACLE'),NAME('EMP'),PRE(EMP)

P_EKY_EMP  KEY(EMP:EMPNO),NOCASE,OPT,PRIMARY

KEY_DEP    KEY(EMP:DEPTNO),DUP,NOCASE,OPT

Record     RECORD

EMPNO       SHORT !Emp-no

ENAME       CSTRING(11) !Employee name

JOB         CSTRING(10) !Job

HIREDATE    DATE !Hiredate

MGR         SHORT !Manager

SAL         PDECIMAL(7,2) !Salary

COMM        PDECIMAL(7,2) !Commisison

DEPTNO      BYTE

          END

         END

MyView VIEW(EMP)

       PROJECT(EMP:EmpNo)

      END

 CODE

   OPEN(EMP)

   OPEN(MyView)

  MyView{'EMP:EmpNo',PROP:NAME} = 'count(*)'

   SET(MyView)

   NEXT(MyView)

This example will produce the equivalent of “SELECT count(*) FROM EMP”.

runtime_sql_properties_for_views_using_sql_drivers.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1