視圖創建失敗:ORA-01027: 不可在資料定義作業中使用連結變數

BrainStormLi 2008-09-24 05:08:14
創建視圖代碼如下:
CREATE OR REPLACE VIEW sales_mal_price_query (NAME,
vendorid,
short,
cost_unitprice,
face,
glue,
release,
thickness,
barcode,
mc_color_text
)
AS
SELECT a.NAME, a.vendorid, b.short, g.cost_unitprice,
a.face || c.mc_face_text AS face,
a.glue || d.mc_glue_text AS glue,
a.release || e.mc_release_text AS release, a.thickness, a.barcode,
f.mc_color_text
FROM material.material a,
sales.vendor b,
material.mc_face c,
material.mc_glue d,
material.mc_release e,
material.mc_color f,
(SELECT MAX (x.cost_unitprice) cost_unitprice, y.barcode
FROM material.all_material_price_range x,
material.material y
WHERE x.barcode(+) = y.barcode
GROUP BY y.barcode) g
WHERE DECODE (:p_vendorid, NULL, '1', a.vendorid) =
DECODE (:p_vendorid,
NULL, '1',
:p_vendorid
)
AND DECODE (:p_face, NULL, '1', a.face) =
DECODE (:p_face,
NULL, '1',
:p_face
)
AND DECODE (:p_glue, NULL, '1', a.glue) =
DECODE (:p_glue,
NULL, '1',
:p_glue
)
AND DECODE (:p_release, NULL, '1', a.release) =
DECODE (:p_release,
NULL, '1',
:p_release
)
AND DECODE (:p_name, NULL, '1', a.NAME) LIKE
'%' || DECODE (:p_name, NULL, '1', :p_name)
|| '%'
AND a.vendorid = b.vendorid
AND a.face = c.mc_face_code
AND a.glue = d.mc_glue_code
AND a.release = e.mc_release_code
AND a.color1 || a.color2 = f.color1 || f.color2
AND a.barcode = g.barcode
ORDER BY barcode


報錯:ORA-01027: 不可在資料定義作業中使用連結變數
ORA-01027 bind variables not allowed for data definition operations

Cause: An attempt was made to use a bind variable in a SQL data definition operation.

Action: Such bind variables are not allowed.

不知該怎樣處理??求助!
...全文
268 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
BrainStormLi 2008-09-24
  • 打赏
  • 举报
回复
不好意思。犯低級錯誤。

創建視圖中帶了些不該帶的參數 -_-!
BlueskyWide 2008-09-24
  • 打赏
  • 举报
回复
1.先给p_vendorid,p_face等赋初值;

2.把:p_vendorid,:p_face等中的":"号去掉改为:p_vendorid,p_face。

17,382

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧