Ticker

6/recent/ticker-posts

PLSQL|| Records

 


Records: Records is one of type PLSQL data types. It is composite data type which is combination of diffrent type of data types. And each scalar data type holds value same as row in table.

Syntax for Records:
TYPE xxrec_type IS RECORD
(
column1   datatype,
column2    datatype,
.......n
);

e.g.:
DECLARE
TYPE vendor_type IS RECORD
(
supplier_name varchar2(50),
supplier_number ap_suppliers.segment1%type,
vendor_id ap_suppliers.vendor_id%type,
supplier_alt_name varchar2(250),
currency_code ap_suppliers.invoice_currency_code%type
);
--
vendor_rec vendor_type;


we can assign value in select statement in execution block of plsql as shown below.

SELECT vendor_name,
segment1,
vendor_id,
invoice_currency_code
INTO
vendor_rec.supplier_name,
vendor_rec.supplier_number,
vendor_rec.vendor_id,
vendor_rec.currency_code
FROM ap_suppliers;

Post a Comment

0 Comments