<原创><AS/400>怎样在CL中执行SQL语句。
上一篇 /
下一篇 2008-04-28 16:55:21
/ 个人分类:AS/400 技术
1.EXECUTE(Execute An SQL View):The EXECUTE command places the results of a view into a database
output file. SEQUEL checks the output file for compatibility with
the view and allows the new data to replace or be appended to any
existing records in the file member.
The output file can be used in application programs or downloaded to
a personal computer. In addition, SEQUEL can create an empty
outfile containing no records, but having the format of the view.
The file can be used in compiling a high level language program
which will use the Open SQL File (OPNSQLF) command.
Either an SQL statement or a view name must be specified for the
command. If an SQL statement is entered, a temporary view named
QTEMP/SQLEXEC is created prior to processing. This view is
automatically deleted when the command completes.
EXECUTE SQL('SELECT * FROM XXXXXX') +
TOFLR('XXXXXXX') +
TODOC(XXXXXXXX) PCFMT(*DELIMITED) +
REPLACE(*YES)
2.DELETE:DELETE SQL('from QTEMP/XXXXXX where (XXXXX="KAMATH" +
or XXXXXX="JONESM")') .
3.SQL(Execute SQL Statement) :SQL SQLSTM('INSERT INTO +
XXXXXXX (SELECT * +
FROM XXXXXXX WHERE XXXXX= +
''ACTIVE'' AND XXXXXX NOT IN +
(''RENT'', ''LEASE''))')
4.PRINT(Print An SQL View) :The PRINT command routes query output to the printer. Data is
directed to the SEQUEL printer files (SQLPRT1,2,3,..,7) and placed
on the output queue identified by your job. Parameters specified on
the command control the page width and length of the report. If the
edited data from your view exceeds the page width, the surplus will
be printed on up to seven separate pages, creating an "extra- wide"
report.
If the standard paper size at your installation is different from
the PRINT command defaults, use the CHGCMDDFT command to change them
so that you need not continually specify these values.
Either an SQL statement or a view name must be specified for the
command. If an SQL statement is entered, a temporary view named
QTEMP/SQLEXEC is created prior to processing. This view is automatically deleted when the command completes.
The TEXT keyword may be specified if an SQL statement is specified,
but not if a view name is given. The text, either from the command
or the view, will appear at the top of each report page as a title.
Many command parameters are identical to those required by the
Create View (CRTVIEW) command. You can override values specified on
the CRTVIEW definition and indicate new values to be used during
this execution of the retrieval.
The parameter default of *SAME indicates that values supplied when
the view was created should apply during this execution. If an SQL
statement is supplied on the command, values for parameters you do
not specify default to those supplied with the CRTVIEW command. Refer to the description of CRTVIEW for a complete description of each parameter not discussed below.
print sql('select * from qtemp/XXXXXXXX') +
ovrflw (63) text (&text)
5.UPDATE:UPDATE SET((SHCOMP '"N"')) SQL('from shopxmit')
导入论坛
引用链接
收藏
分享给好友
推荐到圈子
管理
举报
TAG: