My first Script

Hi All,

I created my first script that will display all table fields. since the tables are too many, I write script that will automate describe all the tables and put into one file.

I know for the others, this is very simple script but since this is my first time I don't know how to debug the error.

anybody can help me?

  1. The problem statement, all variables and given/known data:
    this is the error;
ora_describe_table.sh[5]: describe: not found [No such file or directory]
ora_describe_table.sh[5]: describe: not found [No such file or directory]
ora_describe_table.sh[5]: describe: not found [No such file or directory]
ora_describe_table.sh[5]: describe: not found [No such file or directory]
  1. Relevant commands, code, scripts, algorithms:
#!/bin/sh
cat Match_Table
sqlplus user/pwd@TABLE
while read Match; do
      describe table TABLE.$Match >> Describe_table.txt
done < Match_Table
exit
  1. The attempts at a solution (include all code and scripts):

  2. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    Xavier university, Philippines, lincaro, computer engineering

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

describe is NOT a command known to the shell. I think you need to do the loop inside ORACLE.

1 Like

Thanks RudiC..

I amend my script but there another error. can you help point my mistake. Thanks

while read match
do
  sqlplus user/pwd@table <<EOF
  describe $match;
done < Match_Table
exit
EOF

ora_describe_table.sh: syntax error at line 10: `do' unmatched

Read the error message carefully and look at your script to find out why the done can't be found:

while read match
do                              <-----------+
  sqlplus user/pwd@table <<EOF          <-- | --+
  describe $match;                          |   |
done < Match_Table              <-----------+   |
exit                                            |
EOF                                     <-------+
1 Like

Thanks RudiC.. got it and is working now..:slight_smile:

1 Like