DBMS_OUTPUT.PUT_LINE이 인쇄되지 않습니다.
다음 코드를 실행할 때 프로 시저가 완료되었다고 표시하고 내가 원하는 정보 (firstName, lastName)를 인쇄하지 않고 아래 표의 선택 쿼리에서 다른 값을 인쇄하지 않습니다.
CREATE OR REPLACE PROCEDURE PRINT_ACTOR_QUOTES (id_actor char)
AS
CURSOR quote_recs IS
SELECT a.firstName,a.lastName, m.title, m.year, r.roleName ,q.quotechar from quote q, role r,
rolequote rq, actor a, movie m
where
rq.quoteID = q.quoteID
AND
rq.roleID = r.roleID
AND
r.actorID = a.actorID
AND
r.movieID = m.movieID
AND
a.actorID = id_actor;
BEGIN
FOR row IN quote_recs LOOP
DBMS_OUTPUT.PUT_LINE('a.firstName' || 'a.lastName');
end loop;
END PRINT_ACTOR_QUOTES;
/
서버 출력을 설정하면
a.firstNamea.lastName
a.firstNamea.lastName
a.firstNamea.lastName
a.firstNamea.lastName
여러 번!
"그냥 절차가 끝났다고 말하는 것"의 "그것"은 무엇입니까?
기본적으로 대부분의 도구는 dbms_output
쓰기 위한 버퍼를 구성 하지 않으며 코드 실행 후 해당 버퍼에서 읽기를 시도하지 않습니다. 반면에 대부분의 도구는 그렇게 할 수 있습니다. SQL * Plus에서는 명령을 사용해야합니다 set serveroutput on [size N|unlimited]
. 그래서 당신은 뭔가를 할 것입니다
SQL> set serveroutput on size 30000;
SQL> exec print_actor_quotes( <<some value>> );
SQL Developer View | DBMS Output
에서 DBMS Output 창을 활성화 한 다음 녹색 더하기 아이콘을 눌러 특정 세션에 대해 DBMS Output을 활성화합니다.
또한 모든 행에 대해 리터럴 "a.firstNamea.lastName"을 인쇄하지 않는다고 가정하면
FOR row IN quote_recs
LOOP
DBMS_OUTPUT.PUT_LINE( row.firstName || ' ' || row.lastName );
END LOOP;
- 메뉴 표시 줄의보기 옵션을 통해 Dbms 출력 창이 열려 있는지 확인하십시오.
- 녹색 '+'기호를 클릭하고 데이터베이스 이름을 추가하십시오.
- 'DBMS_OUTPUT.ENABLE;'쓰기 절차 내에서 첫 번째 줄로. 이것이 문제를 해결하기를 바랍니다.
이 진술
DBMS_OUTPUT.PUT_LINE ( 'a.firstName'|| 'a.lastName');
문자열을있는 그대로 인쇄하는 것을 의미합니다. 인쇄 할 값을 얻기 위해 따옴표 를 제거합니다 . 올바른 구문은 다음과 같습니다.
DBMS_OUTPUT.PUT_LINE(a.firstName || a.lastName);
첫 번째 줄에서 아래와 같이 쿼리를 설정하십시오.
SET SERVEROUTPUT ON
Oracle SQL Developer를 사용하고 있습니다.
이 도구에서는 dbms_output.put_line에 의해 인쇄 된 결과를보기 위해 DBMS 출력 을 활성화 해야했습니다.
You can find this option in the result pane where other query results are displayed. so, in the result pane, I have 7 tabs. 1st tab named as Results, next one is Script Output and so on. Out of this you can find a tab named as "DBMS Output" select this tab, then the 1st icon (looks like a dialogue icon) is Enable DBMS Output. Click this icon. Then you execute the PL/SQL, then select "DBMS Output tab, you should be able to see the results there.
All of them are concentrating on the for loop but if we use a normal loop then we had to use of the cursor record variable. The following is the modified code
CREATE OR REPLACE PROCEDURE PRINT_ACTOR_QUOTES (id_actor char)
AS
CURSOR quote_recs IS
SELECT a.firstName,a.lastName, m.title, m.year, r.roleName ,q.quotechar from quote q, role r,
rolequote rq, actor a, movie m
where
rq.quoteID = q.quoteID
AND
rq.roleID = r.roleID
AND
r.actorID = a.actorID
AND
r.movieID = m.movieID
AND
a.actorID = id_actor;
recd quote_recs%rowtype;
BEGIN
open quote_recs;
LOOP
fetch quote_recs into recs;
exit when quote_recs%notfound;
DBMS_OUTPUT.PUT_LINE(recd.firstName||recd.lastName);
end loop;
close quote_recs;
END PRINT_ACTOR_QUOTES;
/
참고URL : https://stackoverflow.com/questions/10434474/dbms-output-put-line-not-printing
'program story' 카테고리의 다른 글
활동을 포 그라운드로 가져 오는 방법 (스택 맨 위)? (0) | 2020.10.09 |
---|---|
Guice의 인젝터에서 주석이 달린 인스턴스를 검색하는 방법은 무엇입니까? (0) | 2020.10.09 |
? :,?!의 차이점은 무엇입니까? (0) | 2020.10.09 |
열에 'hsa ..'와 같은 문자열이있는 행 선택 (부분 문자열 일치) (0) | 2020.10.09 |
HashMap에서 효율적으로 조회하고 삽입하는 방법은 무엇입니까? (0) | 2020.10.08 |