MySQL Forums
Forum List  »  General

Re: Passing variable to SQL script
Posted by: Ravi Kotichintala
Date: September 30, 2008 09:47PM

Kay's solution is brilliant (just note that it did not work for me without putting a semicolon at the end of 'source run.sql;'). This however is the fountainhead idea from which heavy automation can be derived. Lot of us are used to massive Oracle script based installers that setup core data for customizing an app.

Linux being the most preferred platform for automation and scripting - here's a simple example of how to extend this solution to that affect:

SHELL SCRIPT
. . . .
echo Installing Data
mysql -e "set @firstname:=$1; set @lastname=$2; source run.sql;"

SQL RUN.SQL
insert into customers (firstname, lastname) values (@firstname, @lastname)

Nothing phenomenal but the potential is obvious. Automation with scripts, integration directly with the UI . . . list goes on

Options: ReplyQuote


Subject
Written By
Posted
Re: Passing variable to SQL script
September 30, 2008 09:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.