Home » Infrastructure » Linux » simple shell script insert
simple shell script insert [message #296200] Fri, 25 January 2008 01:42 Go to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
#!bin/bash
sqlplus -s treas/treas <<EOF
DECLARE
  I  NUMBER := 1;
BEGIN
  LOOP
    INSERT INTO A
    VALUES     (I);
    
    I := I + 1;
    
    EXIT WHEN I > 10;
  END LOOP;
END;
EXIT;
EOF

The script runs
but it is not inserting the records.
What modification needs to be done?

[Updated on: Fri, 25 January 2008 01:43]

Report message to a moderator

Re: simple shell script insert [message #296205 is a reply to message #296200] Fri, 25 January 2008 01:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Add a commit?

Regards
Michel
Re: simple shell script insert [message #296211 is a reply to message #296200] Fri, 25 January 2008 01:55 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
After adding the commit,the result is the same.
#!bin/bash
sqlplus -s treas/treas <<EOF
DECLARE
  I  NUMBER := 1;
BEGIN
  LOOP
    INSERT INTO A
    VALUES     (I);
    
    I := I + 1;
    
    EXIT WHEN I > 10;
  END LOOP;
COMMIT;
END;
EXIT;
EOF

[Updated on: Fri, 25 January 2008 01:56]

Report message to a moderator

Re: simple shell script insert [message #296212 is a reply to message #296200] Fri, 25 January 2008 01:58 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
Ok got it.
Its plsql code. it needs a "/" to execute.
#!bin/bash
sqlplus -s treas/treas <<EOF
DECLARE
  I  NUMBER := 1;
BEGIN
  LOOP
    INSERT INTO A
    VALUES     (I);
    
    I := I + 1;
    
    EXIT WHEN I > 10;
  END LOOP;
COMMIT;
END;
/
EXIT;
EOF

Re: simple shell script insert [message #296238 is a reply to message #296200] Fri, 25 January 2008 03:56 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
Now if i have to run a script,i have to manually type
$sh file.sh

Is there any way where just double clicking the file would execute the script?
Re: simple shell script insert [message #296243 is a reply to message #296238] Fri, 25 January 2008 04:33 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Double click on what?
It depends on what you have on your environment.

Regards
Michel
Re: simple shell script insert [message #296244 is a reply to message #296200] Fri, 25 January 2008 04:35 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
I have saved my shell script with .sh extension in desktop.
If i have to run the script,the normal course of action is
--opening the terminal
--sh file.sh

but iwant to execute the script on double clicking the script itself.
icon14.gif  Re: simple shell script insert [message #296246 is a reply to message #296244] Fri, 25 January 2008 04:44 Go to previous messageGo to next message
tannad
Messages: 43
Registered: January 2008
Location: mumbai
Member
Hii
If U are using unix or Linux as Backend
then it is not possible by double clicking it..
u have to run it by
#./yourscript.sh
If Graphical mode ,It can be possible Smile
Re: simple shell script insert [message #296247 is a reply to message #296200] Fri, 25 January 2008 04:54 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
Quote:
Hii
If U are using unix or Linux as Backend
then it is not possible by double clicking it..
u have to run it by
#./yourscript.sh
If Graphical mode ,It can be possible


Thats understood.
How to do in graphical mode?
Re: simple shell script insert [message #296248 is a reply to message #296247] Fri, 25 January 2008 05:13 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is not an Oracle question.
You should post this question in a Linux forum.

Regards
Michel
Previous Topic: Installation Fail - Development Suits 10R1 on RHEL4
Next Topic: Linking problems
Goto Forum:
  


Current Time: Sun Dec 04 00:17:52 CST 2016

Total time taken to generate the page: 0.08377 seconds