Mysql stored procedure - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Mysql stored procedure

Hi..
I have written stored procedure in mysql...It is executing perfectly...After putting the dump file in advanced installer it was showing the error as shown below..
{SQL_ERROR}:{SQL_STATE:42000}[MYSQL][ODBC 5.1 Driver][mysqld-5.0.27-comunity-nt]You Have an error in Your Sql Syntax;
check the manual that corresponds to your my sql version for the right syntax to use near DELIMITER at line 1.

my procedure is
BEGIN
delete from login WHERE TimeStamp < DATE_SUB(NOW(), INTERVAL 2 DAY);
END

while taking the scripts into advanced installer i have chosen the delimiter ; i am using sql 5.0 version.....
i do not know why it is coming...If any one knows about this...please help me....it is very important...reply me as early as possible.............
CiprianComsa
Posts: 110
Joined: Thu Aug 19, 2010 10:11 am
Contact: Website

Re: Mysql stored procedure

Hi,

I'm not sure why this happens. Can you please send us your .AIP (project) file and SQL Script or a small similar test case reproducing this issue to support at advancedinstaller dot com so we can investigate them?

Regards,
Ciprian
__________________________________________________________________________________________________________________________________________________
Ciprian Comsa
Advanced Installer Team
http://www.advancedinstaller.com/
Ciprian Comsa - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Re: Mysql stored procedure

Hi,
i have attached my setup.aip.....file please find the attachment and let me know what is the solution for that...Thanku..
Attachments
setup.aip
.aip
(268.68 KiB) Downloaded 728 times
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Re: Mysql stored procedure

Hi,
i have attached my sql script.....file please find the attachment and let me know what is the solution for that......Thanku..
Attachments
sevate1sp.txt
my sql script
(431.09 KiB) Downloaded 842 times
CiprianComsa
Posts: 110
Joined: Thu Aug 19, 2010 10:11 am
Contact: Website

Re: Mysql stored procedure

Hi,

A solution is to split the SQL script file in 2 script files:
- the first script that would contain the queries up to the stating the stored procedure and with the semicolon statement separator
- the second script that would contain only the stored procedure with another statement separator.

The Statement Separator can be defined from the script's settings on the right pane for each file script.
Please note the statement separator must always begin with a letter and can contain only alpha-numeric characters.

Here is the step by step tutorial you can follow. Also, here is the complete article on SQL Scripts from our user guide.

Regards,
Ciprian
__________________________________________________________________________________________________________________________________________________
Ciprian Comsa
Advanced Installer Team
http://www.advancedinstaller.com/
Ciprian Comsa - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Re: Mysql stored procedure

Hi,
Can u please tell how to split my script in mysql.....
thanku
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Re: Mysql stored procedure

I want to use same database name for 2 scripts...If i am writing the procedure in separate sql it asking for tables...u database doesnt contain tables...like that it is showing...i am adding the dump file directly...i am not writing queries in advanced installer...What should i do?....explain me clearly....i follwed the same procedure what is written in advanced inastaller......
Thanku
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Mysql stored procedure

Hi,
please give me reply...its very urgent....If any one knows the solution give me reply....


Thanku
CiprianComsa
Posts: 110
Joined: Thu Aug 19, 2010 10:11 am
Contact: Website

Re: Mysql stored procedure

Hi,

Split your dump file using a text editor and add them in the following order:
- The first file must contain the queries up to the declaration of the stored procedure with the semicolon(;) statement separator
The Statement Separator can be defined from the Scripts page.
Please note the semicolon statement is generally used to separate multiple SQL statements.

- The second must contain only the stored procedure but with another statement than the semicolon.
In such commands like CREATE PROCEDURE, CREATE FUNCTION, CREATE TRIGGER the semicolon is a separator between the SQL queries and is part of the stored procedure. For this reason, the stored procedure must exist in another file compared to the rest of the script and must have another Statement separator (SQL Batch file separator) defined in Advanced Installer different to the semicolon.

Please note all scripts will be executed in the order they appear in the tree.

Regards,
Ciprian
__________________________________________________________________________________________________________________________________________________
Ciprian Comsa
Advanced Installer Team
http://www.advancedinstaller.com/
Ciprian Comsa - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Re: Mysql stored procedure

Hi ,
Thanks for giving me reply....I have tried with that.....but it is not working....again it was showing the same error ....please tell me another solution...for this...here i am attaching my sql scripts....please check once...If u find any error in that..let me know that....
Thanks.
Attachments
procedure.txt
procedure
(244 Bytes) Downloaded 654 times
database.txt
database up to stored procedure declaration
(430.86 KiB) Downloaded 715 times
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Mysql stored procedure

Hi,
please give me reply.....i have tried by putting the two scripts in transaction....that time also it was showing...same error..why it was happening?...please give me a proper solution for that........Its very important....give me reply as early as possible...
Thanks,
Anusha.
CiprianComsa
Posts: 110
Joined: Thu Aug 19, 2010 10:11 am
Contact: Website

Re: Mysql stored procedure

Hi,
This can be done by following these steps:
1. Open your database.txt file (from your previous post) with a text editor and delete DELIMITER declaration from the script.
2. Add this file in Scripts page and make sure you have in Advanced Installer semicolon Statement Separator.
3. Open your procedure.txt file (from your previous post) with a text editor and delete DELIMITER declaration and ";;" from the end of script.
Please note: USE statement is not allowed in a stored procedure. Anyway, is already selected the database during this step.
4. Add this file in Scripts page and define another statement separator in Advanced Installer (For example : GO).

Make sure the SQL code you supply is well-tested before deployment. You can test your scripts using SQL Editor (with statement separator).

Regards,
Ciprian
__________________________________________________________________________________________________________________________________________________
Ciprian Comsa
Advanced Installer Team
http://www.advancedinstaller.com/
Ciprian Comsa - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Re: Mysql stored procedure

Hi,
Thanks for giving me reply...before what i sent u ...that i was not writing the script...while creating dump file...it was coming like that... we have edited in the text editor...after editing... it was not showing any procedure in our database..so advanced installer is showing the error...

please tell me proper solution...
Regards,
Anusha.
enkey
Posts: 18
Joined: Tue Dec 13, 2011 3:50 pm

Re: Mysql stored procedure

Hi,
Thanks alot...... its working perfectly..............

regards,
ANusha

Return to “Common Problems”