SQL ora-06553 pls-306 调用“ogc_x”时的参数数量或类型错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13687766/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ora-06553 pls-306 wrong number or types of arguments in call to 'ogc_x'
提问by linker85
I′m trying a query in oracle 10g. It goes like this:
我正在尝试在 oracle 10g 中进行查询。它是这样的:
SELECT
*
FROM
h2h_reg reg,
h2h_cat_estatus est
WHERE
reg.FECH_APLICACION = SYSDATE
AND REG.ID_EST = EST.ID_ESTATUS
AND est.tipo_estatus = "X";
So it runs smootly, but when I try it adding a group by:
所以它运行得很顺利,但是当我尝试通过以下方式添加组时:
SELECT
reg.id_arch,
reg.id_prod
FROM
h2h_reg reg,
h2h_cat_estatus est
WHERE
reg.FECH_APLICACION = SYSDATE
AND reg.id_est = est.id_estatus
AND EST.TIPO_ESTATUS = "X"
GROUP BY
reg.id_arch,
reg.id_prod;
I get the next message:
我收到下一条消息:
ora-06553 pls-306 wrong number or types of arguments in call to 'ogc_x'
ora-06553 pls-306 调用“ogc_x”时的参数数量或类型错误
Does anyone knows what′s wrong in my query?
有谁知道我的查询有什么问题?
回答by DazzaL
you've used double quotes on "X"
.
你在"X"
.上使用了双引号。
this should be 'X'
.
这应该是'X'
。
the X object is an function in the MDSYS schema, "ogc_x", so when you say est.tipo_estatus = "X"
instead of the correct est.tipo_estatus = 'X'
it gets translated (as "" is as an identifier so "X" is the same as just typing X) to est.tipo_estatus = mdsys.ogc_x
and of course fails.
X 对象是 MDSYS 模式中的一个函数,“ogc_x”,所以当你说的est.tipo_estatus = "X"
不是正确的时候,est.tipo_estatus = 'X'
它会被翻译(因为“”是一个标识符,所以“X”与只输入 X 是一样的)est.tipo_estatus = mdsys.ogc_x
,当然失败。
回答by xlecoustillier
Try with DISTINCT
:
尝试DISTINCT
:
SELECT DISTINCT reg.id_arch, reg.id_prod
FROM h2h_reg reg, h2h_cat_estatus est
WHERE reg.FECH_APLICACION = SYSDATE
AND reg.id_est = est.id_estatus
AND est.tipo_estatus = 'X'
回答by John Argus
I found that this error was generated because I had used Oracle reserved words to name some of my columns, e.g. date, time, comment, etc. Once I renamed the columns the problem disappeared.
我发现这个错误是因为我使用 Oracle 保留字来命名我的一些列,例如日期、时间、评论等。一旦我重命名了这些列,问题就消失了。