Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

APEX PL/SQL: CREATE TABLE with dynamic table name (variable)

Mischa123Oct 29 2018 — edited Oct 30 2018

Hi everybody,

I want to create new tables based on the input from a text field provided by the user.

The idea is that the user types in a name and APEX creates a new table named by the users input with a small addition. Thereupon, all data from TB_TEST shall be inserted into the new table created.

Therefore, I added a processing with following PL/SQL Code:

DECLARE

v_variable VARCHAR2(30);

SET v_variable := :P6_NAME;

CREATE TABLE v_variable + '_Addition' AS

       SELECT *

       FROM TB_TEST;

Doing this, I get following error:

ORA-06550: line 26, column 1: PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: begin function pragma procedure subtype type <an identifier> <a double-quoted delimited-identifier> current cursor delete exists prior

I am using APEX 5.1. and already checked the FAQ and the Help Center, but couldn't find an answer as I am new to SQL.

I would be grateful if somebody could help me.

Many thanks in advance!

Mischa

Comments
Post Details
Added on Oct 29 2018
9 comments
2,318 views