Sponsored Content
Full Discussion: Syntax problem Oracle
Special Forums UNIX and Linux Applications Syntax problem Oracle Post 303000724 by bdby on Tuesday 18th of July 2017 02:10:51 PM
Old 07-18-2017
Syntax problem Oracle

Hi All,
I have a syntax problem with a procedure in oracle. I am looking to just produce the number of rows
from each table located in the HR schema nothing complex. This procedure works great up to dbms_output.put_line(tab_var); where it lists the names of each table in the user schema.
My problem lies in the next line: select count(*) into ct_var from tab_var; which produces the
following error:
Code:
LINE/COL ERROR
-------- -----------------------------------------------------------------
19/2 PL/SQL: SQL Statement ignored
19/35 PL/SQL: ORA-00942: table or view does not exist

I am thinking with a fresh pair of eyes someone can see where the sytax error is. This is just
for practice.
Any suggestions would be appreciated.

Created as the HR user in the HR schema. Not sys or system


Code:
CREATE OR REPLACE PROCEDURE TAB_ROW_COUNT 
AS
 tab_var  varchar2(4000);
 ct_var   number;
 cursor c1 is select table_name from user_tables ;
 begin
  open c1; 
 for i in 1..7  loop
  fetch c1 into tab_var;
  dbms_output.put_line(tab_var);
  --select count(*) into ct_var from tab_var;
  --dbms_output.put_line('There are ' || ct_var || 'rows in' || tab_var 'table');
 
 end loop;
end;
/


Last edited by rbatte1; 07-19-2017 at 08:00 AM.. Reason: Added ICODE tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

syntax problem

dear friends, I have a large size file containg two fields data like this *** **** 122 222 ***** ***** ***** ***** 232 233 i have file like this. i want to remove blank lines from file . i think awk is servive this problem i wrote a awk command but the error is... (3 Replies)
Discussion started by: rajan_ka1
3 Replies

2. Shell Programming and Scripting

syntax problem

Dear friends, I am writing shell script in csh . i want to make arthimatic operation in csh. i wrote sysntax like this. set val = 230 set tmp = `0.1 * $val + 300` echo $tmp but it is not working . anyone please give me syntax. (3 Replies)
Discussion started by: rajan_ka1
3 Replies

3. UNIX for Dummies Questions & Answers

Oracle like syntax required

m kinda new to unix. i have been trying to write a script where i am trying to switch between users. but the problem is that the syntax like USERNAME/PASSWORD (like oracle SCOT/TIGER) is not working. if i write su USERNAME then the script goes to the command prompt and asks for user to enter... (0 Replies)
Discussion started by: ShellBoy
0 Replies

4. Shell Programming and Scripting

syntax problem grepping?

I am calculating a time and appending a space in front of it to get only certain records in a file because the times are represented in HH:II:SS format and I don't want to see anything other than the actual hour and minute combination (hence appending the space to the front of the time). My... (9 Replies)
Discussion started by: dsimpg1
9 Replies

5. Shell Programming and Scripting

Help for Sed Syntax problem

I have one File named "txt_file" # cat txt_file <DBType>RT</DBType> <AppType>RT</AppType> -------------------------------------------------- I want replace "<AppType>RT</AppType>" to <AppType>XY</AppType> in txt_file and output redirect to Newfile ... (2 Replies)
Discussion started by: SanjayLinux
2 Replies

6. Shell Programming and Scripting

CShell Syntax Problem

Hi guys, Basically I'm trying to write a CShell script that calls an awk script on a given directory (given in command-line). I keep getting a syntax error with my code though: #!/bin/csh set dir = $ARGV foreach file ( $dir/* ) set output = 'awk -f /Desktop/aal $file' echo... (3 Replies)
Discussion started by: ROFL
3 Replies

7. Shell Programming and Scripting

Syntax Problem with awk

Hello, I have perl script,which take some part of data in the file. the below command works fine in normal cmd prompt. `awk '/CDI/ && // && !/Result for/ {print $3 $5 > "final.txt"}' datalist.txt`; `nawk -F"" '{print $2}' finalcdi.txt`; But not working. Please use code tags, thanks. (5 Replies)
Discussion started by: rasingraj
5 Replies

8. Shell Programming and Scripting

Problem with if-else syntax

I'm calling the following if-else from nawk. But I keep getting an error at the "else". I've tried putting more brackets and ; but still I get complaints about the "else". Any ideas ? Thanks, wbrunc BEGIN { FS = "," ; OFS = "," } { if ( $8 ~ /A/ && $9 == B ) $1="4/29/2013" ; $2="J.Doe"... (2 Replies)
Discussion started by: wbrunc
2 Replies

9. Shell Programming and Scripting

awk syntax problem

Hi, I am using this awk command in my shell script : find . -name "*" -ctime -6 | xargs cat | grep -E -v ^fileName\|^\(\) | awk -v DATE="${CURR_DATE}" -v DATE_LOG=$DATE_SYS 'BEGIN {FS=";";OFS=";";CONVFMT="%.9g";OFMT="%.9g"}... (4 Replies)
Discussion started by: abhi1988sri
4 Replies

10. Shell Programming and Scripting

awk problem with syntax

awk -v sw="lemons|dogs" 'NR>100 && NR<200 BEGIN { c=split(sw,a,""); } { for (w in a) { if ($0 ~ a) d]++; } } END { for (i in a) { o=o (a"="(d]?d]:0)","); } sub(",*$","",o); print o; }' /home/jahitt/data.txt what am i doing wrong with the above code? im pretty sure the issue is in the... (6 Replies)
Discussion started by: SkySmart
6 Replies
SQL::Translator::Schema(3pm)				User Contributed Perl Documentation			      SQL::Translator::Schema(3pm)

NAME
SQL::Translator::Schema - SQL::Translator schema object SYNOPSIS
use SQL::Translator::Schema; my $schema = SQL::Translator::Schema->new( name => 'Foo', database => 'MySQL', ); my $table = $schema->add_table( name => 'foo' ); my $view = $schema->add_view( name => 'bar', sql => '...' ); DESCSIPTION
"SQL::Translator::Schema" is the object that accepts, validates, and returns the database structure. METHODS
as_graph_pm Returns a Graph::Directed object with the table names for nodes. add_table Add a table object. Returns the new SQL::Translator::Schema::Table object. The "name" parameter is required. If you try to create a table with the same name as an existing table, you will get an error and the table will not be created. my $t1 = $schema->add_table( name => 'foo' ) or die $schema->error; my $t2 = SQL::Translator::Schema::Table->new( name => 'bar' ); $t2 = $schema->add_table( $table_bar ) or die $schema->error; drop_table Remove a table from the schema. Returns the table object if the table was found and removed, an error otherwise. The single parameter can be either a table name or an "SQL::Translator::Schema::Table" object. The "cascade" parameter can be set to 1 to also drop all triggers on the table, default is 0. $schema->drop_table('mytable'); $schema->drop_table('mytable', cascade => 1); add_procedure Add a procedure object. Returns the new SQL::Translator::Schema::Procedure object. The "name" parameter is required. If you try to create a procedure with the same name as an existing procedure, you will get an error and the procedure will not be created. my $p1 = $schema->add_procedure( name => 'foo' ); my $p2 = SQL::Translator::Schema::Procedure->new( name => 'bar' ); $p2 = $schema->add_procedure( $procedure_bar ) or die $schema->error; drop_procedure Remove a procedure from the schema. Returns the procedure object if the procedure was found and removed, an error otherwise. The single parameter can be either a procedure name or an "SQL::Translator::Schema::Procedure" object. $schema->drop_procedure('myprocedure'); add_trigger Add a trigger object. Returns the new SQL::Translator::Schema::Trigger object. The "name" parameter is required. If you try to create a trigger with the same name as an existing trigger, you will get an error and the trigger will not be created. my $t1 = $schema->add_trigger( name => 'foo' ); my $t2 = SQL::Translator::Schema::Trigger->new( name => 'bar' ); $t2 = $schema->add_trigger( $trigger_bar ) or die $schema->error; drop_trigger Remove a trigger from the schema. Returns the trigger object if the trigger was found and removed, an error otherwise. The single parameter can be either a trigger name or an "SQL::Translator::Schema::Trigger" object. $schema->drop_trigger('mytrigger'); add_view Add a view object. Returns the new SQL::Translator::Schema::View object. The "name" parameter is required. If you try to create a view with the same name as an existing view, you will get an error and the view will not be created. my $v1 = $schema->add_view( name => 'foo' ); my $v2 = SQL::Translator::Schema::View->new( name => 'bar' ); $v2 = $schema->add_view( $view_bar ) or die $schema->error; drop_view Remove a view from the schema. Returns the view object if the view was found and removed, an error otherwise. The single parameter can be either a view name or an "SQL::Translator::Schema::View" object. $schema->drop_view('myview'); database Get or set the schema's database. (optional) my $database = $schema->database('PostgreSQL'); is_valid Returns true if all the tables and views are valid. my $ok = $schema->is_valid or die $schema->error; get_procedure Returns a procedure by the name provided. my $procedure = $schema->get_procedure('foo'); get_procedures Returns all the procedures as an array or array reference. my @procedures = $schema->get_procedures; get_table Returns a table by the name provided. my $table = $schema->get_table('foo'); get_tables Returns all the tables as an array or array reference. my @tables = $schema->get_tables; get_trigger Returns a trigger by the name provided. my $trigger = $schema->get_trigger('foo'); get_triggers Returns all the triggers as an array or array reference. my @triggers = $schema->get_triggers; get_view Returns a view by the name provided. my $view = $schema->get_view('foo'); get_views Returns all the views as an array or array reference. my @views = $schema->get_views; make_natural_joins Creates foriegn key relationships among like-named fields in different tables. Accepts the following arguments: o join_pk_only A True or False argument which determins whether or not to perform the joins from primary keys to fields of the same name in other tables o skip_fields A list of fields to skip in the joins $schema->make_natural_joins( join_pk_only => 1, skip_fields => 'name,department_id', ); name Get or set the schema's name. (optional) my $schema_name = $schema->name('Foo Database'); translator Get the SQL::Translator instance that instantiated the parser. AUTHOR
Ken Youens-Clark <kclark@cpan.org>. perl v5.14.2 2012-01-20 SQL::Translator::Schema(3pm)
All times are GMT -4. The time now is 03:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy