prosource

SQL*Plus에서 화면 지우기

probook 2023. 8. 1. 20:37
반응형

SQL*Plus에서 화면 지우기

다음 보고서를 실행 중이지만 오류가 발생합니다.

/* 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;

오류가 표시되는 이유와 실행 방법만 알면 됩니다. 처음으로 SQL에서 보고서를 작성합니다.

이것이 제가 받는 오류입니다.

화면 지우기; * 라인 2의 오류: ORA-00900: 잘못된 SQL 문

cl scr는 SQL에서 화면을 지우는 데 사용되는 명령입니다.

사용 중인 Oracle 버전에 따라 다를 수 있습니다.

이것은 버전 11.2에서 작동해야 하지만 10g 설명서에서 인용하자면 다음과 같습니다.

CLEAR SCREEN은 SQL*Plus에서 사용할 수 없습니다.

11.1 설명서에는 동일한 내용이 없습니다. 즉, Oracle 10g 이전 버전을 사용하고 있다는 의미입니다.이 가정이 사실이라면 당신이 할 수 있는 일은 거의 없습니다.

Windows(윈도우)를 사용하는 경우 SQL*Plus에서 명령을 사용하여 실행하거나 Linux(리눅스)를 사용하는 경우 실행할 수 있지만, 정확히 동일한 효과를 얻을 수 있을지는 모르겠습니다.가능하다면 다음과 같습니다.

host cls

hostSQL*Plus에서 운영 체제 명령을 실행하므로 화면이 지워지는 것으로 나타납니다.

단순한 사용cl scr명령을 사용하여 SQL Plus를 지웁니다.

코드에서 실제로 필요한 ";" 항목은 거의 없습니다.예를 들어, "화면 지우기" 명령은 세미콜론이 필요하지 않습니다.하나를 추가하면 작동하지만 동일한 파일에 있는 모든 후속 명령에 대해서는 확신할 수 없습니다.이러한 명령이 필요한 명령은 INSERT, UPDATE, DELETE, COMMIT, Rollback 등으로 제한됩니다.

둘째, SQL 파일에서 이상한 피드백을 받고 Linux/Unix 외부에서 작성한 경우 SQLPLUS에서 보이지 않는 문자에 대해 불평하는 경우가 많습니다.VI 명령과 CAT 명령을 모두 사용하여 해당 파일을 보고 이상한 내용을 기록하십시오.

언급URL : https://stackoverflow.com/questions/13661757/clear-screen-in-sqlplus

반응형