0

Do you have any idea why this won't work?

I want to create a table then add items to it and display it. It should be simple but every time I try I get a crash or an error.

CREATE TABLE test 
(a varchar(255),
    b varchar(255),
    c varchar(255),
    d varchar(255)
);
insert into test
(a,b,c,d)
Values
('dd','tt','te','rt');
select * from test
MT0
  • 143,790
  • 11
  • 59
  • 117
Ian
  • 31
  • 6
  • 3
    what tool are you using that crashes? what are the errors? Worked for me in Toad against Oracle 19c. Although you should use VARCHAR2. – Gary_W Jan 04 '23 at 18:25
  • ORA-00942: table or view does not exist 00942. 00000 - "table or view does not exist" *Cause: *Action: Error at Line: 11 Column: 15 – Ian Jan 04 '23 at 18:31
  • It all works [fiddle](https://dbfiddle.uk/oxrRB5wj) – MT0 Jan 04 '23 at 18:31
  • It's most likely permissions then. Preface the table name with your schema like `ian.test` – Gary_W Jan 04 '23 at 18:32
  • then the second time i run it i get, Table TEST created. but no data is putin – Ian Jan 04 '23 at 18:33
  • then the third time Error starting at line : 1 in command - CREATE TABLE test (a varchar(2), b varchar(2), c varchar(2), d varchar(2) ) Error report - ORA-00955: name is already used by an existing object 00955. 00000 - "name is already used by an existing object" *Cause: *Action: – Ian Jan 04 '23 at 18:34
  • @Ian the third time, the table is still there from prior runs, so the CREATE table is unnecessary. You can destroy and re-create it each time by starting your script with this: DROP TABLE IF EXISTS `ian.TEST`; (https://stackoverflow.com/questions/1799128/oracle-if-table-exists) – JosephStyons Jan 04 '23 at 18:38
  • 1
    if you prefaced your table with a schema as Gary_W suggested, then you need to do the same with your insert, as in INSERT INTO IAN.TEST(... – JosephStyons Jan 04 '23 at 18:39

1 Answers1

0

It is because the system cant keep up with me creating it seems to be more a permissions/server side thing :)

Ian
  • 31
  • 6