Processing Data via PL/SQL

2751 단어 PL/SQLPL/SQL

https://www.udemy.com/course/plsql-by-example/learn/lecture/3169110#overview

Reading data from database

DECLARE 
    customerId number := 10;
    customerName varchar2(50);
    customerAddress varchar2(50);
BEGIN
    SELECT first_name, country INTO customerName, customerAddress
    FROM customer
    WHERE customer_id := customerId;
END;

%TYPE

DECLARE 
    customerId customer.customer_id%type := 10;
    customerName customer.first_name%type;
    customerAddress customer.country%type;
    -- 이렇게 해두면 customer의 country 타입이 변하는 경우에도 
BEGIN
    SELECT first_name, country INTO customerName, customerAddress
    FROM customer
    WHERE customer_id := customerId;
END;

좋은 웹페이지 즐겨찾기