如何使用替换变量设置LINESIZE和PAGESIZE? [英] How do I set LINESIZE and PAGESIZE with a substitution variable?
问题描述
我正在尝试使用SQL * Plus中的PL/SQL脚本,根据开发人员对报告应以横向还是纵向打印的输入来设置行大小和页面大小.如果是横向,则我希望线宽为132,页面大小为60.如果是纵向,则我分别为88和80.
I am trying to use a PL/SQL script in SQL*Plus to set the linesize and pagesize based on a developer input on whether a report should print in landscape or portrait orientation. If it is landscape, I want linesize 132 and pagesize 60. If it is portrait, I want 88 and 80 respectively.
我正在尝试使用替代变量来做到这一点:
I am trying to use substitution variables to do so like this:
DEFINE PRINT_ORIENTATION 'PORTRAIT'
COLUMN LINESIZE_VALUE NOPRINT new_value LINE
COLUMN PAGESIZE_VALUE NOPRINT new_value PAGE
SELECT DECODE('&PRINT_ORIENTATION', 'PORTRAIT', 88, 'LANDSCAPE', 132) AS LINE,
DECODE('&PRINT_ORIENTATION', 'PORTRAIT', 80, 'LANDSCAPE', 60) AS PAGE
FROM DUAL
/
SET LINESIZE &LINE
SET PAGESIZE &PAGE
但是,系统仅提示我手动输入行和页面的值.在SET命令中使用替换变量该怎么办?
However, the system then just prompts me to manually enter values for line and page. What do I need to do to use a substitution variable in the SET command?
推荐答案
That allows you to define a substitution value from a query result.
这篇关于如何使用替换变量设置LINESIZE和PAGESIZE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!