Oracle变量
我正在尝试编写一个 Oracle 查询,该查询在查询之前设置了一些变量,然后我可以在查询中引用这些变量。
我可以在 SQL Server 中执行以下操作:
DECLARE @ReviewID as VARCHAR(3)
DECLARE @ReviewYear AS VARCHAR(4)
SET @ReviewID = 'SAR'
SET @ReviewYear = '1011'
select * from table1 where review_id = @ReviewID and acad_period = @reviewyear
Oracle 中与上述操作等效的是什么?我尝试过游标和绑定变量,但显然我做错了什么,因为这些方法不起作用。
Oracle 查询旨在进入 SSIS 中的 OLEDB 源,然后从包级别变量设置变量。
I am trying to write an Oracle query that has some variables set before the query which i can then reference within the query.
I can do the below in SQL Server:
DECLARE @ReviewID as VARCHAR(3)
DECLARE @ReviewYear AS VARCHAR(4)
SET @ReviewID = 'SAR'
SET @ReviewYear = '1011'
select * from table1 where review_id = @ReviewID and acad_period = @reviewyear
What is the Oracle equivalent of the above? I have tried cursors and bind variables but am obviously doing something wrong as these methods aren't working.
The Oracle query is intended to go into an OLEDB Source in SSIS and the variables will then be set from package level variables.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SQL Plus 中的 Oracle 等效项:
Oracle equivalent in SQL Plus:
如果您要在 OleDb Source from 变量中使用此查询,您可能需要使用表达式而不是 SQL 变量。因此,您可以按照以下方式构建 SQL 语句
If you're going to be using this query in an OleDb Source from variable, you'll likely need to use an Expression as opposed to SQL variables. So you'd build the SQL statement along the lines of