Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Please enlight me! ;-)
Sat, Jan 5 2013 8:52 PMPermanent Link

Mario Enríquez

Open Consult

Hello everybody,

Could anybody please enlightme as to why this script wouldn't run on EDBMGR?

SCRIPT
BEGIN
  USE TestDB1;

  CREATE TABLE GRL_CTA_HABIENTE (
      ID_CTA_HABIENTE GUID NOT NULL,
      NOMBRE_COMERCIAL VARCHAR(100) NOT NULL,
      RAZON_SOCIAL VARCHAR(100),
      NIT VARCHAR(20),
      WEBSITE VARCHAR(100),
      TELEFONO VARCHAR(20),
      CONSTRAINT "PK_GRL_CTA_HABIENTE" PRIMARY KEY ("ID_CTA_HABIENTE")
  );

  USE;
END

Everytime I run it, I got the following error:

"ElevateDB Error #700 An error was found in the statement at line 11 and column 4 (Expected end of expression but instead found USE)"

I've read the manual and the sample posted in this forum and it appears to be complaint statement. What I may doing wrong?

Regards,
Mario
Sat, Jan 5 2013 11:09 PMPermanent Link

IQA

Hi Mario,

Just a guess, not tried it, but should the CREATE TABLE section not use
the EXECUTE IMMEDIATE '' ???

for example...


SCRIPT
BEGIN
   USE TestDB1;

   EXECUTE IMMEDIATE 'CREATE TABLE GRL_CTA_HABIENTE
   (
       ID_CTA_HABIENTE GUID NOT NULL,
       NOMBRE_COMERCIAL VARCHAR(100) NOT NULL,
       RAZON_SOCIAL VARCHAR(100),
       NIT VARCHAR(20),
       WEBSITE VARCHAR(100),
       TELEFONO VARCHAR(20),
       CONSTRAINT "PK_GRL_CTA_HABIENTE" PRIMARY KEY ("ID_CTA_HABIENTE")
   )';

   USE;
END

I hope that works for you.

Cheers,

Phil.



On 6/01/2013 12:52 PM, Mario Enríquez wrote:
> Hello everybody,
>
> Could anybody please enlightme as to why this script wouldn't run on EDBMGR?
>
> SCRIPT
> BEGIN
>     USE TestDB1;
>
>     CREATE TABLE GRL_CTA_HABIENTE (
>         ID_CTA_HABIENTE GUID NOT NULL,
>         NOMBRE_COMERCIAL VARCHAR(100) NOT NULL,
>         RAZON_SOCIAL VARCHAR(100),
>         NIT VARCHAR(20),
>         WEBSITE VARCHAR(100),
>         TELEFONO VARCHAR(20),
>         CONSTRAINT "PK_GRL_CTA_HABIENTE" PRIMARY KEY ("ID_CTA_HABIENTE")
>     );
>
>     USE;
> END
>
> Everytime I run it, I got the following error:
>
> "ElevateDB Error #700 An error was found in the statement at line 11 and column 4 (Expected end of expression but instead found USE)"
>
> I've read the manual and the sample posted in this forum and it appears to be complaint statement. What I may doing wrong?
>
> Regards,
> Mario
>
Sun, Jan 6 2013 1:25 PMPermanent Link

Mario Enríquez

Open Consult

Thank you Phil, enclosing the script with EXECUTE IMMEDIATE has done it.

BTW, Is this the only way to apply an script to create tables?

I have a big script and I would like avoid inserting EXECUTE IMMEDIATE  in every DDL statement to make it work.

regards,
Mario
Sun, Jan 6 2013 4:26 PMPermanent Link

Adam Brett

Orixa Systems


>>I have a big script and I would like avoid inserting EXECUTE IMMEDIATE  in every DDL statement to make it work.

Sorry Mario as far as I know each piece of DDL needs to be wrapped with:

EXECUTE IMMEDIATE '<statement here> ';

--
... I usually use EDBMgr's "convert Into Script" menu item to automate this:

1. In a new SCRIPT in EDBMgr, add a ";" to the end of each CREATE segment.
2. Select "Script", "Convert into Script" from the menu.
Sun, Jan 6 2013 4:35 PMPermanent Link

Mario Enríquez

Open Consult

Bummer... Frown

But thanks on the "Convert Into Script" tip, I'll look into it.

Regards,
Mario
Image