Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL Question - using a var. in create

Re: SQL Question - using a var. in create

From: Kevin Bourque 428-6924 <Kevin.Bourque_at_NSPOWER.NS.CA>
Date: Mon, 22 Jan 1996 16:55:19 -0400
Message-Id: <9601222133.AA16537@alice.jcc.com>


Joe, use the concatenate operator (||), and make both parts strings:

    '&&prefix'||'HSCH'

KJB
>I need some help with this one. Here's what I'm trying to do:
>
>1. Execute a script called create_tables.sql that prompts the user
> for a "table name prefix". I need to create similar tables each
> semester each with the same last 4 characters but starting with a
> different profix (i.e. F96HSCH, S96HSCH, U96HSCH, etc.). My "create"
> script does this:
>
> ACCEPT prefix PROMPT CHAR 'Enter a tablename prefix:'
>
> and the user would enter S96 for example.
>
>2. Next a second script runs that does a create table command using that
> variable as part of the name:
>
> CREATE TABLE &&prefixHSCH
> ...
>
> resulting in a table name like S96HSCH, tacking the suffix HSCH to the
> variable name.
>
>No matter what I do, I can't get the pfix variable to add itself as a prefix
>to the HSCH part. I've tried:
>
> '&&prefix'HSCH
> "&&prefix"HSCH
>
>In both cases the ' and " are interpreted literally. Is there a way to do
>this?
>
>Thanks!
>
>Joe Johnson
>Highland Community College
Received on Mon Jan 22 1996 - 16:33:51 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US