Skip to content

Instantly share code, notes, and snippets.

@arn-ob
Created December 4, 2018 14:19
Show Gist options
  • Select an option

  • Save arn-ob/ede5d059efe843527d4281ac51d42894 to your computer and use it in GitHub Desktop.

Select an option

Save arn-ob/ede5d059efe843527d4281ac51d42894 to your computer and use it in GitHub Desktop.
MySQL Store Procedure
CREATE PROCEDURE `post`(IN `p_id` VARCHAR(50),
IN `name` VARCHAR(50),
IN `kha_name` VARCHAR(50),
IN `kha_type` VARCHAR(50),
IN `kha_details` VARCHAR(50),
IN `kha_price` VARCHAR(50),
IN `kha_qnty` VARCHAR(50),
IN `kha_img1` VARCHAR(50),
IN `kha_img2` VARCHAR(50),
IN `kha_img3` VARCHAR(50),
IN `user_id` VARCHAR(50),
IN `user_username` VARCHAR(50))
NOT DETERMINISTIC NO SQL SQL SECURITY DEFINER
BEGIN
INSERT INTO post( post.post_id,
post.name,
post.khabar_name,
post.khabar_type,
post.khabar_details,
post.khabar_price,
post.khabar_qnty,
post.khabar_img1,
post.khabar_img2,
post.khabar_img3,
post.u_id,
post.created_time,
post.created_time)
VALUES ( p_id,
name,
kha_name,
kha_type,
kha_details, kha_price, kha_qnty, kha_img1, kha_img2, kha_img3, user_id, CURRENT_TIME, CURRENT_DATE);
INSERT INTO public_post( public_post.post_id,
public_post.kahbar_name,
public_post.post_username,
public_post.khabar_price,
public_post.khabar_type,
public_post.khabar_qnty,
public_post.created_date,
public_post.created_time)
VALUES (p_id,
kha_name,
user_username,
kha_price,
kha_type,
kha_qnty, CURRENT_DATE, CURRENT_TIME);
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment