Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Command file and input truncation and some other things
Hello, I have written this command file:
$ cat create_manager_table.sql
-- TODO: Check if manager table exists already and, if so, prompt
--DBMS_OUTPUT.PUTLINE('Test');
ALTER TABLE employee
DROP CONSTRAINT fk_emp_mgr;
ALTER TABLE dept
DROP CONSTRAINT fk_dept_employee;
CREATE TABLE manager
(key INTEGER NOT NULL,
bonus INTEGER DEFAULT 0 NOT NULL,
PRIMARY KEY(key),
FOREIGN KEY(key) REFERENCES employee(key)
);
INSERT INTO manager(key)
((SELECT DISTINCT manager
FROM employee
WHERE manager IS NOT NULL)
UNION
(SELECT DISTINCT manager
FROM dept));
ALTER TABLE dept
ADD CONSTRAINT fk_dept_manager
FOREIGN KEY(manager) REFERENCES manager(key);
UPDATE manager
SET bonus=(bonus + 10000)
WHERE key IN (
SELECT manager FROM dept
);
When I run it, the following output is generated: SQL> @ create_manager_table.sql
Table altered.
Table altered.
Table created.
12 rows created.
Table altered.
Table altered.
Input truncated to 5 characters
11 rows updated.
SQL> What exactly is Oracle complaining about regarding the message about input truncation and how do I fix it? And any ideas how I should implement the comment at the top the command file (check if a table already exists before proceeding). And how do I print out arbitrary text in the command file?
/ E Received on Tue Mar 28 2006 - 10:29:19 CST