I keep getting the following message every time I try to run this code in oracle. The code is as follows:
DROP TABLE movie;
CREATE TABLE movie (movie_id NUMBER(5) PRIMARY KEY,
title VARCHAR2(45) NOT NULL,
description VARCHAR2(250) NOT NULL,
released_by NUMBER(3) NOT NULL,
released_on DATE NOT NULL);
INSERT INTO movie (movie_id, title, description, released_by, released_on)VALUES ('1', 'Edge of Tomorrow', 'Lieutenant Colonel Bill Cage is a skilled tactician who has honed his abilities through his experiences as a soldier. However, there is still much he can learn, and soon he is going to get his chance.', '1', '07-OCT-2014');
INSERT INTO movie (movie_id, title, description, released_by, released_on)VALUES('2', 'Captain America: Winter Soldier', 'Steve Rogers is finding it difficult to adjust to living life in the contemporary world. He is working for S.H.I.E.L.D. and begins to suspect a mystery is brewing there.', '2', '09-SEP-2014');
INSERT INTO movie (movie_id, title, description, released_by, released_on)VALUES('3', 'Fed Up', 'America’s problem with obesity is caused by our inactivity. Or is it? Katie Couric and Stephanie Soechtig tempt us to restructure our beliefs about the American diet, through this thought-provoking expose.', '3', '09-SEP-2014');
INSERT INTO movie (movie_id, title, description, released_by, released_on)VALUES('4', 'Godzilla', 'The legendary tale of Godzilla comes roaring back to life. This time, it's the modern era, and Godzilla is a giant lizard who has been made fearsome through the interference of radiation.', '1', '16-SEP-2014');
INSERT INTO movie (movie_id, title, description, released_by, released_on)VALUES('5', 'Neighbors', 'New parents Mac and Kelly settle into domesticity in a quiet neighborhood. The tranquility they have been afforded ceases to exist when a fraternity moves into the house next door.', '2', '14-SEP-2014');
COMMIT;
Below is what I get when I try to execute it in Oracle:
Table dropped.
Table created.
1 row created.
1 row created.
1 row created.
ERROR:
ORA-01756: quoted string not properly terminated
1 row created.
Commit complete.
SQL>
Any help would be greatly appreciated. Thank you.
Try Oracle's quoting mechanisms :
The mechanism is invoked with a simple "q" in PL/SQL only.
The syntax is q'[...]', where the "[" and "]" characters can be any of the following as long as they do not already appear in the string.
•!
•[ ]
•{ }
•( )
•< >
Here For Example ,
INSERT INTO movie (movie_id, title, description, released_by, released_on)
VALUES('4', 'Godzilla', q'[The legendary tale of Godzilla comes roaring back to
life. This time, it's the modern era, and Godzilla is a giant lizard who has
been made fearsome through the interference of radiation.]', '1', '16-SEP-
2014');
It's always headache to find all single quotes and replace it with escape character.
For more Reference Follow : THIS
Escape single quotes:
INSERT INTO movie (movie_id, title, description, released_by, released_on)VALUES('4', 'Godzilla', 'The legendary tale of Godzilla comes roaring back to life. This time, it''s the modern era, and Godzilla is a giant lizard who has been made fearsome through the interference of radiation.', '1', '16-SEP-2014');
Notice the it''s
instead of it's
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With