定义变量
SET @applicationNumber = 'Br-A146799000';
变量中引用变量
SET @appNoBefore = (SELECT app_no FROM fs_biz_info WHERE application_number = @applicationNumber LIMIT 1);
SET @appNoAfter = (SELECT app_no FROM fs_biz_info WHERE application_number = @applicationNumber LIMIT 1, 1);
SET @videoUrl = (SELECT video_url FROM fs_biz_rel WHERE app_no = @appNoBefore);
update语句中引用变量
UPDATE fs_biz_rel SET biz_sts = '0005', have_uploaded = 'Y', have_signed = 'Y', review_request = 'Y',
video_url = @videoUrl WHERE app_no = @appNoAfter;
insert、select语句中引用变量
INSERT INTO `vr_face_rslt` (`rqs_id`, `app_no`, `rel_typ`, `time_used`, `rslt_cde`, `rslt_msg`, `verify_score`,
`thresholds_stages`, `verify_threshold`, `attack_score`, `attack_threshold`, `attack_rslt`, `verify_img`,
`crt_dt`, `crt_usr`, `is_deleted`)
(SELECT `rqs_id`, @appNoAfter, `rel_typ`, `time_used`, `rslt_cde`, `rslt_msg`, `verify_score`,
`thresholds_stages`, `verify_threshold`, `attack_score`, `attack_threshold`, `attack_rslt`, `verify_img`,
`crt_dt`, `crt_usr`, `is_deleted` FROM vr_face_rslt WHERE app_no = @appNoBefore);
INSERT INTO `vr_idcard_ocr_rslt` (`rqs_id`, `app_no`, `rel_typ`, `rslt_cde`, `card_typ`, `side`, `name`,
`gender`, `nationality`, `id_no`, `address`, `birthday`, `issued`, `valid_date_start`, `valid_date_end`,
`verify_img`, `portrait`, `verify_score`, `verify_threshold`, `completeness`, `crt_dt`, `crt_usr`, `is_deleted`)
(SELECT `rqs_id`, @appNoAfter, `rel_typ`, `rslt_cde`, `card_typ`, `side`, `name`, `gender`, `nationality`,
`id_no`, `address`, `birthday`, `issued`, `valid_date_start`, `valid_date_end`, `verify_img`, `portrait`,
`verify_score`, `verify_threshold`, `completeness`, `crt_dt`, `crt_usr`, `is_deleted` FROM vr_idcard_ocr_rslt
WHERE app_no = @appNoBefore);