|
-
create table or insert into table
How can I check if table exists and if not create one else insert into table. Please advise. See example below as create command fails as expects end etc..
DECLARE
counter INTEGER := 0;
mytotal INTEGER := 0;
BEGIN
SELECT
COUNT( 1 )
INTO
counter
FROM
user_tables
WHERE
table_name like 'testing';
mytotal := mytotal + counter;
IF ( mytotal != 0 ) THEN
INSERT
INTO testing (implemented)
VALUES ('testing123');
Else
CREATE TABLE testing (
implemented varchar2 (40),
date_run date
)
TABLESPACE mytblspace;
END;
/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|