COMP 353 Tips
Posted on April 15, 2006
I wrote this two scipts for COMP353 Database project. I found them usefull.
This one-liner is used to create DROP statements in invers order of table and views creation.
tac create_tables.sql | grep CREATE | awk ‘{print “DROP ” $2 ” ” $3 “;”}’ | sed s/\(//g > drop_script.sql
and I used this query to create a nice HTML report that showed instance data in every relation. Run it in SQL*Plus
SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON -
HEAD “TITLE Project Report /TITLE” -
BODY “TEXT=’#FF00Ff’” -
TABLE “WIDTH=’90%’ BORDER=’5′”SPOOL report.html
SELECT * FROM ADMINISTRATOR;
SELECT * FROM ANNOUNCEMENT;
SELECT * FROM AUCTION;
…….
SPOOL OFF
BTW in Oracle, you can use this query to get a list of your relations
SELECT table_name FROM user_tables;
Filed Under Uncategorized |
Leave a Comment
If you would like to make a comment, please fill out the form below.