1. It looks like Oracle syntax to me. It will definitely work with MySql but syntax has to be changed.
To check how syntax goes in MySql follow
this link
2. It does not insert into any other table. It selects the column values and assigns them to the mentioned variables.
In the above PlSql statement, value of USERNAME column is assigned to
o_username variable, CREATED_BY to
o_createdby variable and so on which are declared while creating the stored procedure.
3. This is Oracle syntax and I guess does not work with MySql.
This statement tells MySql to declare a variable
p_userid of type USER_ID column from DBUSER table.
So if USER_ID is a VARCHAR(20), the variable
p_userid will be VARCHAR(20).
Flow of execution of JDBC program:
It initializes Statement to call the Stored Procedure.
It passes user id to the Stored Procedure as input parameter.
It gets user name, created by and created date as output parameters from Stored Procedure and prints them.
For this specific code, you have to create only 1 table, i.e., DBUSER.