求高人指点一下关于oracle问题!
时间:2011-11-16
来源:互联网
我在sqlserver中得语句是这样的!
declare @i int
@i=1
IF(@i='-1')
SELECT
*
FROM TBTAX_INVOICE ta
LEFT JOIN TBORG_BASEUNIT c1
ON c1.flID = ta.FLORGID
LEFT JOIN TBTAX_PROJECTS c2
ON c2.flID = ta.flProjectID
WHERE
ta.flprojectID IS NULL
and ta.flState in ('')
and ta.flMode in ('')
and ta.flType in ('')
else
SELECT
*
FROM TBTAX_INVOICE ta
LEFT JOIN TBORG_BASEUNIT c1
ON c1.flID = ta.FLORGID
LEFT JOIN TBTAX_PROJECTS c2
ON c2.flID = ta.flProjectID
WHERE
ta.flprojectID=''
and ta.flState in ('')
and ta.flMode in ('')
and ta.flType in ('')
那么怎么把它转化为oracle中得语句呢? 求改高人指点!
declare @i int
@i=1
IF(@i='-1')
SELECT
*
FROM TBTAX_INVOICE ta
LEFT JOIN TBORG_BASEUNIT c1
ON c1.flID = ta.FLORGID
LEFT JOIN TBTAX_PROJECTS c2
ON c2.flID = ta.flProjectID
WHERE
ta.flprojectID IS NULL
and ta.flState in ('')
and ta.flMode in ('')
and ta.flType in ('')
else
SELECT
*
FROM TBTAX_INVOICE ta
LEFT JOIN TBORG_BASEUNIT c1
ON c1.flID = ta.FLORGID
LEFT JOIN TBTAX_PROJECTS c2
ON c2.flID = ta.flProjectID
WHERE
ta.flprojectID=''
and ta.flState in ('')
and ta.flMode in ('')
and ta.flType in ('')
那么怎么把它转化为oracle中得语句呢? 求改高人指点!
作者: lrl1286219215 发布时间: 2011-11-16
SQL code
DECLARE i INT; TYPE ref_cursor_type IS REF CURSOR; ref_cursor ref_cursor_type; BEGIN i := 1; IF i = -1 THEN OPEN ref_cursor FOR SELECT * FROM tbtax_invoice ta LEFT JOIN tborg_baseunit c1 ON c1.flid = ta.florgid LEFT JOIN tbtax_projects c2 ON c2.flid = ta.flprojectid WHERE ta.flprojectid IS NULL AND ta.flstate IN ('') AND ta.flmode IN ('') AND ta.fltype IN (''); ELSE OPEN ref_cursor FOR SELECT * FROM tbtax_invoice ta LEFT JOIN tborg_baseunit c1 ON c1.flid = ta.florgid LEFT JOIN tbtax_projects c2 ON c2.flid = ta.flprojectid WHERE ta.flprojectid = '' AND ta.flstate IN ('') AND ta.flmode IN ('') AND ta.fltype IN (''); END IF; END;
作者: tx2730 发布时间: 2011-11-16
declare
i int := 1;
begin
IF(i = -1) then
/*
SELECT *
FROM TBTAX_INVOICE ta
LEFT JOIN TBORG_BASEUNIT c1 ON c1.flID = ta.FLORGID
LEFT JOIN TBTAX_PROJECTS c2 ON c2.flID = ta.flProjectID
WHERE ta.flprojectID IS NULL
and ta.flState in ('')
and ta.flMode in ('')
and ta.flType in ('')
*/
dbms_output.put_line('满足条件');
else
/*
SELECT *
FROM TBTAX_INVOICE ta
LEFT JOIN TBORG_BASEUNIT c1 ON c1.flID = ta.FLORGID
LEFT JOIN TBTAX_PROJECTS c2 ON c2.flID = ta.flProjectID
WHERE ta.flprojectID = ''
and ta.flState in ('')
and ta.flMode in ('')
and ta.flType in ('')
*/
dbms_output.put_line('不满足条件');
end if;
end;
i int := 1;
begin
IF(i = -1) then
/*
SELECT *
FROM TBTAX_INVOICE ta
LEFT JOIN TBORG_BASEUNIT c1 ON c1.flID = ta.FLORGID
LEFT JOIN TBTAX_PROJECTS c2 ON c2.flID = ta.flProjectID
WHERE ta.flprojectID IS NULL
and ta.flState in ('')
and ta.flMode in ('')
and ta.flType in ('')
*/
dbms_output.put_line('满足条件');
else
/*
SELECT *
FROM TBTAX_INVOICE ta
LEFT JOIN TBORG_BASEUNIT c1 ON c1.flID = ta.FLORGID
LEFT JOIN TBTAX_PROJECTS c2 ON c2.flID = ta.flProjectID
WHERE ta.flprojectID = ''
and ta.flState in ('')
and ta.flMode in ('')
and ta.flType in ('')
*/
dbms_output.put_line('不满足条件');
end if;
end;
作者: hupeng213 发布时间: 2011-11-16
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28