Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Command file and input truncation and some other things
Eric Lilja wrote:
> Hello, I have written this command file:
> $ cat create_manager_table.sql
> -- TODO: Check if manager table exists already and, if so, prompt
> -- user to run the the drop_manager_table.sql script first.
>
> --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));
>
> -- Note: These ALTER TABLE statements must be performed
> -- *AFTER* we've filled the manager table with data! This
> -- is because the employee/dept tables already contain
> -- data and the manager table does not.
> ALTER TABLE employee
> ADD CONSTRAINT fk_employee_manager
> FOREIGN KEY(manager)
> REFERENCES manager(key);
>
> 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
It is complaining about the lack of a blank line at the end of the script: Ignore it.
-- Daniel A. Morgan http://www.psoug.org damorgan_at_x.washington.edu (replace x with u to respond)Received on Tue Mar 28 2006 - 10:58:28 CST