I am trying to delete a function / stored procedure from another stored procedure. Is this possible..?
I am getting this error:
Error Code: 1357
Can`t drop or alter a FUNCTION from within another stored routine
- or -
Can`t drop or alter a PROCEDURE from within another stored routine
Related
When we create a procedure it can allows to call other procedure which is run in the server. But if there have a chance to create over one or more procedures inside of a procedure in mysql 5.7.
You cannot use the CREATE PROCEDURE statement inside a procedure body.
mysql> create procedure MyProc()
begin
create procedure MyOtherProc() begin select 1; end;
end //
ERROR 1303 (2F003): Can't create a PROCEDURE from within another stored routine
1.) alternative for stored procedure in mysql which can be altered rather than drop and create again
2.) easy ways to maintain database version i am currently creating log.sql files manually such as example log.sql file
ALTER TABLE `ship`
CHANGE COLUMN `is_deleted` `is_deleted` INT(11) NULL DEFAULT 0 ;
DROP procedure IF EXISTS `get_ship`;
DELIMITER ;;
CREATE PROCEDURE `get_ship`(
)
BEGIN
do something;
end if;
END ;;
DELIMITER ;
Is there an better and easy way to create such sql log files,
I have already tried MYSQL workbench
When you are redefining a table structure with any of the following
drop column,
change column,
modify column,
add column,
rename table
and your stored procedure has dependency on the same table and its pre-defined columns,
then you don't have a choice but redefine part of your stored procedure.
And this can only be achieved by dropping and re-creating the procedure again.
As per documentation on ALTER PROCEDURE Syntax, in MySQL,
However, you cannot change the parameters or body of a stored procedure using this statement; to make such changes, you must drop and re-create the procedure using DROP PROCEDURE and CREATE PROCEDURE.
add column may not require re-building your stored procedure unless the new column too participates in the procedure's algorithm.
I've created a stored procedure in Mysql and I was wondering if there is a command that I can get and store the name of the database that this stored procedure lives in?
How about DATABASE() ?
(This text is just filler)
Your Question is wrong?..Your actual question is you have created a stored procedure inside the databases...not how to retrieve the procedure inside the database?
Ans: To know the created procedure:
mysql:\> show procedure status; //to know the procedure name..sam4 function show function staus;
mysql:\> show use create procedure emptab.test1 //emptab is database name,test1 is the procedure..
I'd like to create a procedure from PHP using PDO...I can execute the procedure with PDO, I can create the procedure with the console line or with phpmyadmin, but I'm not able to create this very same procedure from PDO...
I absolutely need to be able to create this procedure from my php code (it's a setup part of a bigger program, the first step checks if the procedure exists with
SHOW PROCEDURE STATUS LIKE 'name_of_procedure'
if the procedure doesn't exists, I try (but fail) to create it (with prepare/execute couple of methods).
How can I link a stored procedure to a temporary table?
I had a database created named Multi. All the attributes of table registration are copied into the stored procedure. In this you cannot insert from stored procedure. This is just creating a stored procedure and giving it something to hold.
This is the example of it.