vscode-database-client
vscode-database-client copied to clipboard
[BUG]Oracle create function error
- Operating system: MacOS 13.4.1
- Database type and version: Oracle XE 21
execute follow SQL, error reported when create function:
CREATE TABLE "config_meta" (
"id" INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
"app_id" varchar(64) NOT NULL,
"code" varchar(64) NOT NULL,
"property" varchar(64) NOT NULL,
"column_name" varchar(64) NOT NULL,
"description" varchar(128) DEFAULT '',
"sort" INTEGER DEFAULT '0',
"gmt_create" TIMESTAMP DEFAULT SYSDATE,
"gmt_modified" TIMESTAMP DEFAULT SYSDATE
);
create or replace type t_record as object (
"id" integer,
"app_id" varchar(64),
"code" varchar(64),
"property" varchar(64),
"column_name" varchar(64)
);
create or replace type t_table as table of t_record;
-- ERROR HERE!!!
create or replace function return_objects (
p_max_num_rows in number
)
return t_table as
v_ret t_table;
begin
select
t_record("config_meta"."id", "config_meta"."app_id", "config_meta"."code",
"config_meta"."property", "config_meta"."column_name")
bulk collect into
v_ret
from
"config_meta"
where
rownum <= p_max_num_rows;
return v_ret;
end;
-- find error msg
SELECT * FROM user_errors
RETURN_OBJECTS,FUNCTION,1,17,3,"PLS-00103: 出现符号 ""end-of-file""在需要下列之一时:
;
It's OK when use "Oracle Developer Tools for VS Code": https://marketplace.visualstudio.com/items?itemName=Oracle.oracledevtools
The error log shows that the symbol ";" should not be at the end of the SQL, how did you execute the last SQL?