database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
ㆍOracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Oracle Tutorials 11941 게시물 읽기
 News | Q&A | Columns | Tutorials | Devel | Files | Links
No. 11941
WEB상에서 PLSQL로 EXCEL FILE만드는 예제
작성자
정재익(advance)
작성일
2002-09-07 21:17
조회수
8,389

WEB상에서 PLSQL로 EXCEL FILE만드는 예제

=======================================

 

 

CREATE OR REPLACE PROCEDURE toExcel IS

CURSOR c1 IS

SELECT empno, ename, job, sal

FROM emp;

counter NUMBER(3) := 1;

counter2 NUMBER(3) := 2;

BEGIN

-- Tell that it's Excel who shall get the output

owa_util.mime_header(ccontent_type => 'application/vnd.ms-excel');

htp.p('ID;ORACLE');

htp.p(';');

htp.p('; Formatting');

htp.p(';');

-- Align the three first columns to the left

htp.p('F;C1;FG0L;SM0');

htp.p('F;C2;FG0L;SM0');

htp.p('F;C3;FG0L;SM0');

-- Align the last column to the right

htp.p('F;C4;FG0R;SM0');

htp.p(';');

htp.p('; Title Row');

htp.p(';');

htp.p('C;Y1;X1;K"Empno"');

htp.p('C;X2;K"Ename"');

htp.p('C;X3;K"Job"');

htp.p('C;X4;K"Sal"');

FOR l1 IN c1 LOOP

htp.p(';');

htp.p('; Row '||counter);

htp.p(';');

htp.p('C;Y'||counter2);

-- Put in the data

htp.p('C;X1;K"'||l1.empno||'"');

htp.p('C;X2;K"'||l1.ename||'"');

htp.p('C;X3;K"'||l1.job||'"');

htp.p('C;X4;K"'||l1.sal||'"');

counter := counter +1;

counter2 := counter2 +1;

END LOOP;

htp.p(';');

htp.p('; Format Column Widths');

htp.p(';');

htp.p('F;W1 1 10');

htp.p('F;W2 2 10');

htp.p('F;W3 3 10');

htp.p('F;W4 4 10');

htp.p('E');

END;

/

[Top]
No.
제목
작성자
작성일
조회
11944단일행 문자 함수 정리
정재익
2002-09-07
10558
11943PL/SQL 자료 정리 (2)
정재익
2002-09-07
31405
11942PL/SQL 자료 정리 (1)
정재익
2002-09-07
33824
11941WEB상에서 PLSQL로 EXCEL FILE만드는 예제
정재익
2002-09-07
8389
11940Reference Note for Init.Ora Parameter "AUDIT_TRAIL
정재익
2002-09-07
7146
11939SHARED_POOL_SIZE
정재익
2002-09-07
10754
11938DB_BLOCK_BUFFERS
정재익
2002-09-07
8328
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.048초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다