Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2011
    Posts
    4

    Unanswered: Include tablespace name in create table command using Execute Immediate

    Hi ,

    I want to creat a table using execute immediate that includes tablespace name in the create table command. But I don't know the tablespace name that the client is using. Can I incorporate in a script? If yes, then how?

    I have written the following proc. While executing the same , it gives me :
    ORA-00959: tablespace 'V_TABLESPACE_NAME' does not exist.

    create or replace procedure pr_create_table as
    v_tablespace_name varchar2(4000);

    begin

    select distinct tablespace_name into v_tablespace_name
    from user_tables
    where table_name like 'ABC%';

    execute immediate 'create table temp_ABC
    (
    VALID VARCHAR2(10 BYTE) NOT NULL,
    REFE VARCHAR2(50 BYTE) NOT NULL,

    )
    TABLESPACE v_tablespace_name
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    )
    LOGGING
    NOCOMPRESS
    LOB (LONGVALUEBLOB) STORE AS
    ( TABLESPACE v_tablespace_name
    ENABLE STORAGE IN ROW
    CHUNK 8192
    PCTVERSION 10
    NOCACHE
    INDEX (
    TABLESPACE v_tablespace_name
    STORAGE (
    INITIAL 64K
    NEXT 1
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    ))
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    )
    )
    NOCACHE
    NOPARALLEL
    MONITORING';

    commit;

    end;
    /

    Please help.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •