第3行的错误:ORA-00907:缺少右括号

时间:2013-05-06 12:00:21

标签: sql oracle

我正在试图找出错误的来源。 这是我的插入声明。

INSERT INTO dimension_tab
SELECT
TRUNC(DBMS_RANDOM.value(low = > 1, high => 3)) AS fact_1_id,
TRUNC(DBMS_RANDOM.value(low = > 1, high => 6)) AS fact_2_id,
TRUNC(DBMS_RANDOM.value(low = > 1, high => 11)) AS fact_3_id,
TRUNC(DBMS_RANDOM.value(low = > 1, high => 11)) AS fact_4_id,
ROUND(DBMS_RANDOM.value(low = > 1, high => 100), 2) AS sales_value
FROM dual
CONNECT BY level <= 1000;

这是我得到的错误

TRUNC(DBMS_RANDOM.value("low" = > 1, high => 3)) AS fact_1_id,
                          *
ERROR at line 3:
ORA-00907: missing right parenthesis

请告诉我错误发生的地方。谢谢你的推荐

2 个答案:

答案 0 :(得分:5)

运营商为=>,而不是= >

答案 1 :(得分:2)

你误用了DBMS_RANDOM.value和参数;使用

TRUNC(DBMS_RANDOM.value(1, 3)) AS fact_1_id,

Example 摘自Reference