Jas*_*eys 7 sql oracle sqlplus
我正在运行以下报告但收到错误
/* Simple table formatting */
clear screen;
accept Report_File char prompt 'Enter a file name for summary report ';
/*Set up column headers*/
col StoreCode format A8 heading 'Store Code';
col DESCRIPTION format A8 heading 'Item Description';
col PRICE format $999999.99 heading 'Price';
col QUANTITY format 999 heading 'Quantity';
col (Price*Quantity) format $999999.99 heading 'Value';
/*Format and title pages */
set Pause off;
set Feedback off;
set Space 6;
set newpage 2;
set pagesize 54;
set linesize 200;
set underline =;
title center 'Current Stock Value by Store' skip 2 left -
'prepared by Jason Kemeys' &Report_Officer right -
&Todays_Date skip4;
btitle center format 999 SQL.PNO;
/* Set breaks and computes */
break on StoreCode skip 2 on SuppCode skip 1 on Report;
compute sum of (Price*Quantity) on StoreCode;
compute sum of (Price*Quantity) on Report;
/*Select data & send to file*/
spool &Report_File;
select StoreCode, Description, Quantity, Price, (Price*Quantity)
from Stocks
order by StoreCode;
spool off;
/* Clear all settings */
clear breaks;
clear columns;
clear computes;
set Pause on;
Run Code Online (Sandbox Code Playgroud)
只需要知道为什么它显示错误以及如何让它运行; 第一次在SQL中做报告.
这是我得到的错误
清屏;*第2行的错误:ORA-00900:无效的SQL语句
我怀疑这取决于您使用的Oracle版本.
这应该适用于版本11.2,但引用10g文档:
SQL*Plus中没有CLEAR SCREEN.
11.1文档中没有相同的说明,这意味着您使用的是Oracle 10g或更早版本.如果这个假设是真的那么你可以做的很少.
这是可能的,你可以利用host在SQL命令*Plus来运行cls,如果你使用的是Windows,或者clear,如果你正在使用Linux,但我不能肯定它会具有完全相同的效果.如果可能的话,它只会是:
host cls
Run Code Online (Sandbox Code Playgroud)
host从SQL*Plus运行操作系统命令,因此将显示清除屏幕.
| 归档时间: |
|
| 查看次数: |
29756 次 |
| 最近记录: |