Solved

not execute all code

Posted on 2014-09-23
2
295 Views
Last Modified: 2014-09-23
i am trying execute this query in pL/SQL
why is not execute all code? only execute
--TA_ANIO_EJERCICIO
CREATE TABLE TA_ANIO_EJERCICIO(
       idAnioEjercicio NUMBER(8) PRIMARY KEY,
       anio VARCHAR2(4) NOT NULL,
       CONSTRAINT UNQ_TA_ANIO_EJERCICIO
                  UNIQUE (anio)
);

CREATE SEQUENCE SEQ_idAnioEjercicio START WITH 1 INCREMENT BY 1;

CREATE OR REPLACE TRIGGER TGR_ANIO_EJERCICIO_INSERT
BEFORE INSERT ON TA_ANIO_EJERCICIO
FOR EACH ROW
BEGIN
    SELECT SEQ_idAnioEjercicio.Nextval into :new.idAnioEjercicio FROM DUAL;
END;
CREATE-TABLE.sql
0
Comment
Question by:enrique_aeo
2 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40340188
You need a '/' after the PL/SQL blocks.  I also like a show errors just in case.

CREATE OR REPLACE TRIGGER TGR_ANIO_EJERCICIO_INSERT
BEFORE INSERT ON TA_ANIO_EJERCICIO
FOR EACH ROW
BEGIN
    SELECT SEQ_idAnioEjercicio.Nextval into :new.idAnioEjercicio FROM DUAL;
END;
/

show errors
0
 
LVL 15

Expert Comment

by:Haris Djulic
ID: 40340189
Did you execute it as a script ?
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question