在oracle中声明并选择错误

时间:2014-04-22 14:05:13

标签: oracle

我正在尝试在sql developer中运行以下代码。

declare ptbl varchar2(50) := 'TRM_SPAN_MST' ;
begin
select ptbl from dual ; 
end

但显示以下错误

    Error starting at line 8 in command:
    declare ptbl varchar2(50) := 'TRM_SPAN_MST' ;
        begin
        select ptbl from dual ; 
        end
    Error report:
    ORA-06550: line 4, column 7:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

       ; <an identifier> <a double-quoted delimited-identifier>
    The symbol ";" was substituted for "end-of-file" to continue.
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:

2 个答案:

答案 0 :(得分:1)

您遇到语法错误,最后结束后需要;

答案 1 :(得分:0)

您可以执行以下操作以避免出错:

DECLARE 
    ptbl varchar2(50);
BEGIN
    SELECT 'TRM_SPAN_MST' into ptbl FROM DUAL ; 
END;