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 Q&A 26676 게시물 읽기
No. 26676
프로시져에서 데이터가 있으면 테이블조인을 하고 그렇지 않는경우 조인을 하지 않는 방법이 있습니까?
작성자
조기영(darkelf)
작성일
2006-05-08 11:20
조회수
1,396

질문이 참 어려운것 같은데

예를 들면 프로시져에서 ,

 

select count(*) into count1 from table1

select count(*) into count2 from table2

 

if count1 >0 and count2 > 0 then

insert into values select * from Main_table, table1,table2

where Main_table.join_column1 = table1 = table1.join_column1

and Main_table.join_column1 = table2 = table2.join_column2

else if count1 >0 and count2 = 0 then

insert into values select * from Main_table, table1

where Main_table.join_column1 = table1 = table1.join_column1

else if count1=0 and count2 >0 then

insert into values select * from Main_table, table2

where Main_table.join_column2 = table1 = table1.join_column2

else

insert into values select * from Main_table

end

 

이러한 방법으로 해야 하는데

쿼리가 너무 길고 count를 해야 할 테이블 컬럼이 여러개라..

프로시져에서 위와 같은 방법이 아닌 다른 방법이 있는지 이렇게 질문을 올려 봅니다.

 

혹시나 좋은 의견 있으면 답변 부탁 드립니다.

이 글에 대한 댓글이 총 1건 있습니다.
insert into values select * from Main_table, table1,table2
 where Main_table.join_column1 = table1.join_column1 (+)
   and Main_table.join_column1 = table2.join_column2 (+)
임명순(Eurek)님이 2006-05-08 13:17에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
26679archive관련된 파일인지요 [2]
유경희
2006-05-08
1486
26678연속적이지 않은 날짜데이터의 바로 직전 일자 데이타와의 연산 문제 [1]
이진웅
2006-05-08
2372
26677v$session, v$sqltext 에 대해서... [3]
까먹지마
2006-05-08
2484
26676프로시져에서 데이터가 있으면 테이블조인을 하고 그렇지 않는경우 조인을 하지 않는 방법이 있습니까? [1]
조기영
2006-05-08
1396
26675chained rows 가 뭘 의미 하는 건지요 ? [1]
까먹지마
2006-05-08
3108
26674Package를 권한 설정할 때... [2]
초보
2006-05-08
4692
26673오라클에서 숫자만 검색할려면 어떻게 하나요??? [2]
문상옥
2006-05-08
5081
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.026초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다