When I run the script below using F5 (Execute as Script), I get "ERROR line 33, col 1, ending_line 37, ending_col 34: A string is initialized with a value that is too long". If I run it in SQL Plus and QSR, it works fine. Using F9 (Execute as Statement) seems odd too as it shows as successful, but the cursor ends up in the "cLineDelimiter varchar2(10) := CASE Param1" line.
Sample test script that gets the error:
1) Paste the script below in a 'new' Editor window.
CREATE OR REPLACE PACKAGE test_pkg AS
/******************************************************************************
NAME : test_pkg
PURPOSE :
Dependency:
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 ]d jzhao 1. Created this package.
******************************************************************************/
FUNCTION MyFunction(Param1 IN NUMBER) RETURN NUMBER;
PROCEDURE MyProcedure(Param1 IN NUMBER);
-- ######## Package test_pkg End ########
END test_pkg;
/
CREATE OR REPLACE PACKAGE BODY test_pkg AS
/******************************************************************************
NAME: test_pkg
PURPOSE:
Dependency:
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 ]d jzhao 1. Created this package body.
******************************************************************************/
FUNCTION MyFunction(Param1 IN NUMBER) RETURN NUMBER IS
cLineDelimiter varchar2(10) := CASE Param1
WHEN 0 THEN ' , '
WHEN 1 THEN ' and '
WHEN 2 THEN ' or '
END;
BEGIN
RETURN Param1;
END;
PROCEDURE MyProcedure(Param1 IN NUMBER) IS
TmpVar
WORKAROUND:
Run the script using Execute in SQL Plus or Execute in QSR (Quest Script Runner)
STATUS:
Waiting for fix in a future release of Toad for Oracle.
© ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center