在Oracle数据库中,可以使用以下方式来给变量赋值:
DECLARE
v_name VARCHAR2(50);
BEGIN
SELECT name INTO v_name FROM employees WHERE id = 1;
DBMS_OUTPUT.PUT_LINE('Employee name is ' || v_name);
END;
DECLARE
v_salary NUMBER := 5000;
BEGIN
DBMS_OUTPUT.PUT_LINE('Employee salary is ' || v_salary);
END;
DECLARE
v_total_sal NUMBER;
BEGIN
SELECT SUM(salary) INTO v_total_sal FROM employees;
DBMS_OUTPUT.PUT_LINE('Total salary of all employees is ' || v_total_sal);
END;
这些是一些基本的赋值操作,在Oracle数据库中可以使用的方式。