-
Notifications
You must be signed in to change notification settings - Fork 442
Closed as duplicate of#184
Closed as duplicate of#184
Copy link
Labels
Description
Input data
Which SQL and options did you provide as input?
DELIMITER //
CREATE PROCEDURE register_student(
IN student_name VARCHAR(25),
IN student_photo BLOB,
IN student_phone INT(10),
IN student_password VARCHAR(20)
)
BEGIN
DECLARE new_roll_number BIGINT;
-- Insert student details
INSERT INTO students (name, photo, Phone_no)
VALUES (student_name, student_photo, student_phone);
-- Get the last inserted Roll_number
SET new_roll_number = LAST_INSERT_ID();
-- Insert password entry
INSERT INTO student_password (Roll_number, password)
VALUES (new_roll_number, student_password);
END;
//
DELIMITER ;Expected Output
DELIMITER //
CREATE PROCEDURE register_student(
IN student_name VARCHAR(25),
IN student_photo BLOB,
IN student_phone INT(10),
IN student_password VARCHAR(20)
)
BEGIN
DECLARE new_roll_number BIGINT;
-- Insert student details
INSERT INTO students (name, photo, Phone_no)
VALUES (student_name, student_photo, student_phone);
-- Get the last inserted Roll_number
SET new_roll_number = LAST_INSERT_ID();
-- Insert password entry
INSERT INTO student_password (Roll_number, password)
VALUES (new_roll_number, student_password);
END;
//
DELIMITER ;Actual Output
DELIMITER / / CREATE PROCEDURE register_student (
IN student_name VARCHAR(25),
IN student_photo BLOB,
IN student_phone INT (10),
IN student_password VARCHAR(20)
) BEGIN DECLARE new_roll_number BIGINT;
-- Insert student details
INSERT INTO
students (name, photo, Phone_no)
VALUES
(student_name, student_photo, student_phone);
-- Get the last inserted Roll_number
SET
new_roll_number = LAST_INSERT_ID ();
-- Insert password entry
INSERT INTO
student_password (Roll_number, password)
VALUES
(new_roll_number, student_password);
END;
/ / DELIMITER;Usage
- How are you calling / using the library?
in vscode - What SQL language(s) does this apply to?
mysqlite - Which SQL Formatter version are you using?
1.6.0