Calling an Anonymous Block through shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Calling an Anonymous Block through shell script
# 1  
Old 12-06-2011
Data Calling an Anonymous Block through shell script

Hi,
My requirement is to load a LONG datatype data value from one table to another as direct access does not work (DB: ORACLE).
eg.
Code:
SELECT *FROM ALL_VIEWS WHERE TEXT LIKE '%<SEARCH_STRING>%';

As an alternate we are creating a table and trying to insert in it from ALL_VIEWS as direct insert stmt does not work.
Code:
create table myviews(
OWNER     VARCHAR2(150),
VIEW_NAME VARCHAR2(90),
TEXT      CLOB 
);

so we are using an anonymous block to insert the data in myviews :
Code:
begin
for i in (select owner, view_name, text from all_views) 
loop
insert into myviews values (i.owner, i.view_name, i.text);
end loop;
end;

the above stmt works fine on sql prompt but does not respond well through shell script, though no syntax error is caught.
Is there anyway i can select directlt data from ALL_VIEWS
OR
solution to above anonymous block ?
Kindly assist. any help is appreciated.

Last edited by Franklin52; 12-06-2011 at 08:27 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 12-06-2011
Please post the complete script and the exact output/error that you're getting.
# 3  
Old 12-07-2011
In the topic below you will find some ways to execute sqlplus:
-----> https://www.unix.com/shell-programming-scripting/171799-component-pak_popl_suppl-must-declared-error.html

Specifically this post!

I hope it helps!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Call Anonymous block from DB2

Hi, I have a shell script and im trying to call a .sql file. The sql file has a simple Anonymous block. The code is shell script db2 -tvf query.sql the sql file contains SET SERVEROUTPUT ON; BEGIN call dbms_output.put_line( 'Hello' ); END; I get the following error BEGIN... (1 Reply)
Discussion started by: sup
1 Replies

2. Shell Programming and Scripting

[Solved] Calling PL/SQL Block into Shell Script

Hi, i have one simple PL/SQL Block and i have saved it as .sql file, which i am trying to call from UNIX script. PL/SQL block structure CONNECT DB_NAME/PWD@Database whenever SQLERROR EXIT 1; Declare ..Variables... BEGIN --Code-- exception END; exit; I have save this block as... (3 Replies)
Discussion started by: abhii
3 Replies

3. Shell Programming and Scripting

Passing the result of an anonymous pl/sql block to a shell script

Hello, Here is the code i have written to get the count of a plsql query back to the unix. function checkforCOIDs { countcheck=`sqlplus -s $1/$2@$3 whenever oserror exit sql.oscode rollback whenever sqlerror exit sql.sqlcode rollback set serverout on size 2000; set head off feedback off... (2 Replies)
Discussion started by: santosh2eee
2 Replies

4. Shell Programming and Scripting

Invoking SP through Anonymous Block

Hi, I'm writing a Shell script to run a stored procedure through SQL*Plus using the below script and it works well. Test.sh $ORACLE_HOME/bin/sqlplus connect user/pwd@dbname @Test.sql Test.sql call sp_test_procedure() Now, similarly I want to run the below PL/SQL anonymous block... (1 Reply)
Discussion started by: Dev_Dev
1 Replies

5. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

6. Shell Programming and Scripting

To get value from Oracle Anonymous PLSQL block

Hi All, i need you help while accessing the value from anonymous PL/SQL block. Initially our requirement was to get the value from SQL statement. I was doing like... But now i need to use dbms_application_info.set_module in it. So i have planned to use anonymous block instead of SQL... (2 Replies)
Discussion started by: Amit.Sagpariya
2 Replies

7. UNIX for Dummies Questions & Answers

How to block an anonymous ftp user?

Could anyone provide information on how to block a specific client machine from being able to log onto anonymous ftp? (10 Replies)
Discussion started by: dennisheazle
10 Replies

8. Shell Programming and Scripting

Calling shell functions from another shell script

Hi, I have a query .. i have 2 scripts say 1.sh and 2.sh 1.sh contains many functions written using shell scripts. 2.sh is a script which needs to call the functions definded in 1.sh function calls are with arguments. Can some one tell me how to call the functions from 2.sh? Thanks in... (6 Replies)
Discussion started by: jisha
6 Replies

9. Shell Programming and Scripting

Calling Shell Script

Hello Friends, I have bash script on unix server which i want to call from windows server. Basically i want a command line which will call this script on unix server. Any one has any idea regarding this? Help really appreciated!! Thanks, Roshni. (1 Reply)
Discussion started by: onlyroshni
1 Replies

10. Shell Programming and Scripting

Calling shell script ?

hi friends, i'm new to unix and straight away i had to start with the script files. I've a script file which gets called from a menu item on a GUI. This script file again calls .awk file, in performing some tasks , which also generates certain files. I modified the files to generate some... (1 Reply)
Discussion started by: Ravi_Kandula
1 Replies
Login or Register to Ask a Question