By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select * from V$VERSION;
BANNER | BANNER_FULL | BANNER_LEGACY | CON_ID |
---|---|---|---|
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release | Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release Version 23.2.0.0.0 |
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release | 0 |
CREATE OR REPLACE PACKAGE dm_code_creation
AS
PROCEDURE script_add_dates
(target_table IN VARCHAR2,
target_user IN VARCHAR2 DEFAULT NULL
);
PROCEDURE script_merge_statement
(target_table IN VARCHAR2,
target_user IN VARCHAR2 DEFAULT NULL
);
PROCEDURE script_insert_statement
(target_table IN VARCHAR2,
target_user IN VARCHAR2 DEFAULT NULL
);
END;
/
CREATE OR REPLACE PACKAGE BODY dm_code_creation
AS
FUNCTION manage_user
(given_user IN VARCHAR2
) RETURN VARCHAR2
IS
return_value VARCHAR2(30);
BEGIN
IF given_user IS NOT NULL THEN
BEGIN
return_value := given_user;
END;
ELSE
BEGIN
return_value := USER;
END;
END IF;
RETURN return_value;
END;
FUNCTION trim_name
(table_name IN VARCHAR2
) RETURN VARCHAR2
IS
return_value VARCHAR2(30);
BEGIN
IF LENGTH(table_name) > 27 THEN
BEGIN
return_value := SUBSTR(table_name, 1, 27);
END;
ELSE
BEGIN
return_value := table_name;
END;
END IF;
DROP TABLE IF EXISTS my_test_table_1;
CREATE
TABLE my_test_table_1
(
id INT generated as identity NOT NULL ,
value_1 INT NOT NULL,
value_2 VARCHAR2(100) NOT NULL,
CONSTRAINT my_test_table_1_pk PRIMARY KEY(id)
);
begin
dbms_output.put_line('Hello World');
end;
/
1 rows affected
dbms_output:
Hello World
CALL dm_code_creation.script_merge_statement('my_test_table_1');