Processing Data via PL/SQL

WooBuntu·2021년 10월 4일
0

알고쓰자 PL/SQL

목록 보기
2/8

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;

0개의 댓글