{"id":1520,"date":"2017-11-23T21:09:44","date_gmt":"2017-11-23T14:09:44","guid":{"rendered":"https:\/\/oracletutorial.com\/?page_id=1520"},"modified":"2025-05-24T18:53:40","modified_gmt":"2025-05-25T01:53:40","slug":"plsql-select-into","status":"publish","type":"page","link":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/","title":{"rendered":"PL\/SQL SELECT INTO"},"content":{"rendered":"\r\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to use the PL\/SQL <code>SELECT INTO<\/code> statement to fetch data of a single row from a table into variables.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='introduction-to-plsql-select-into-statement'>Introduction to PL\/SQL SELECT INTO statement <a href=\"#introduction-to-plsql-select-into-statement\" class=\"anchor\" id=\"introduction-to-plsql-select-into-statement\" title=\"Anchor for Introduction to PL\/SQL SELECT INTO statement\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>PL\/SQL <code>SELECT INTO<\/code> statement is the simplest and fastest way to fetch a single row from a table into <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-variables\/\">variables<\/a>.<\/p>\r\n\r\n\r\n\r\n<p>Here&#8217;s the syntax of the PL\/SQL <code>SELECT INTO<\/code> statement:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">SELECT<\/span>\r\n  select_list\r\n<span class=\"hljs-keyword\">INTO<\/span>\r\n  variable_list\r\n<span class=\"hljs-keyword\">FROM<\/span>\r\n  <span class=\"hljs-built_in\">table_name<\/span>\r\n<span class=\"hljs-keyword\">WHERE<\/span>\r\n  condition; <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>In this syntax, the number of columns in the <code>variable_list<\/code> must be the same as the number of variables (or the number of components of a record) in the <code>select_list<\/code>.\u00a0 Additionally, their corresponding data type must be compatible.<\/p>\r\n\r\n\r\n\r\n<p>Besides the <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-where\/\">WHERE<\/a><\/code> clause, you can use other clauses in the <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-select\/\">SELECT<\/a><\/code> statement, such as <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-inner-join\/\">INNER JOIN<\/a><\/code>, <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-group-by\/\">GROUP BY<\/a><\/code>, <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-having\/\">HAVING<\/a><\/code>, and <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-union\/\">UNION<\/a><\/code>.<\/p>\r\n\r\n\r\n\r\n<p>If the <code>SELECT<\/code> statement returns more than one row, Oracle will raise the <code>TOO_MANY_ROWS<\/code> <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-exception\/\">exception<\/a>.<\/p>\r\n\r\n\r\n\r\n<p>If the <code>SELECT<\/code> statement does not return any row, Oracle will raise the <code>NO_DATA_FOUND<\/code> exception.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='plsql-select-into-examples'>PL\/SQL SELECT INTO examples <a href=\"#plsql-select-into-examples\" class=\"anchor\" id=\"plsql-select-into-examples\" title=\"Anchor for PL\/SQL SELECT INTO examples\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>We&#8217;ll use the <code>customers<\/code> and <code>contacts<\/code> tables in the <a href=\"https:\/\/www.oracletutorial.com\/getting-started\/oracle-sample-database\/\">sample database<\/a> for demonstration.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"354\" height=\"165\" class=\"wp-image-641\" title=\"PL\/SQL SELECT INTO example\" src=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/contacts_customers_tables.png\" alt=\"PL\/SQL SELECT INTO example\" srcset=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/contacts_customers_tables.png 354w, https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/contacts_customers_tables-300x140.png 300w\" sizes=\"auto, (max-width: 354px) 100vw, 354px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='selecting-one-column-example'>Selecting one column example <a href=\"#selecting-one-column-example\" class=\"anchor\" id=\"selecting-one-column-example\" title=\"Anchor for Selecting one column example\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>The following example uses a <code>SELECT INTO<\/code> statement to retrieve the name of a customer based on the customer id, which is the primary key of the <code>customers<\/code> table.<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">DECLARE<\/span>\r\n  l_customer_name customers.name<span class=\"hljs-meta\">%TYPE<\/span>;\r\n<span class=\"hljs-keyword\">BEGIN<\/span>\r\n  <span class=\"hljs-comment\">-- get name of the customer 100 and assign it to l_customer_name<\/span>\r\n  <span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-type\">name<\/span> <span class=\"hljs-keyword\">INTO<\/span> l_customer_name\r\n  <span class=\"hljs-keyword\">FROM<\/span> customers\r\n  <span class=\"hljs-keyword\">WHERE<\/span> customer_id = <span class=\"hljs-number\">100<\/span>;\r\n\r\n  <span class=\"hljs-comment\">-- show the customer name<\/span>\r\n  dbms_output.put_line( l_customer_name );\r\n<span class=\"hljs-keyword\">END<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>In this example:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>First, declare a variable <code>l_customer_name<\/code> whose data type anchors to the name columns of the <code>customers<\/code> table. This variable will hold the customer&#8217;s name.<\/li>\r\n\r\n\r\n\r\n<li>Second, use the <code>SELECT INTO<\/code> statement to select a value from the name column and assign it to the <code>l_customer_name<\/code> variable.<\/li>\r\n\r\n\r\n\r\n<li>Third, show the customer&#8217;s name using the <code>dbms_output.put_line<\/code> procedure.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>Since the <code>customers<\/code> table has only one row with customer ID 100, the code block displays the customer name.<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\">Verizon<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>If no such row existed, the code block would fail with an unhandled <code>NO_DATA_FOUND<\/code> exception.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='selecting-a-complete-row-example'>Selecting a complete row example <a href=\"#selecting-a-complete-row-example\" class=\"anchor\" id=\"selecting-a-complete-row-example\" title=\"Anchor for Selecting a complete row example\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>The following example fetches the entire row from the <code>customers<\/code> table for a specific customer ID:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">DECLARE<\/span>\r\n  r_customer customers<span class=\"hljs-meta\">%ROWTYPE<\/span>;\r\n<span class=\"hljs-keyword\">BEGIN<\/span>\r\n  <span class=\"hljs-comment\">-- get the information of the customer 100<\/span>\r\n  <span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">INTO<\/span> r_customer\r\n  <span class=\"hljs-keyword\">FROM<\/span> customers\r\n  <span class=\"hljs-keyword\">WHERE<\/span> customer_id = <span class=\"hljs-number\">100<\/span>;\r\n  <span class=\"hljs-comment\">-- show the customer info<\/span>\r\n  dbms_output.put_line( r_customer.name || <span class=\"hljs-string\">', website: '<\/span> || r_customer.website );\r\n<span class=\"hljs-keyword\">END<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>Here is the output:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Verizon, <span class=\"hljs-attr\">website<\/span>: http:<span class=\"hljs-comment\">\/\/www.verizon.com<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>In this example:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>First, declare a <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-record\/\">record<\/a> based on the row of the <code>customers<\/code> table. This record will hold the entire row of the <code>customers<\/code> table.<\/li>\r\n\r\n\r\n\r\n<li>Second, select the customer whose id is 100 into the <code>r_customer<\/code> record.<\/li>\r\n\r\n\r\n\r\n<li>Third, show the customer&#8217;s name and website.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='selecting-data-into-multiple-variables-example'>Selecting data into multiple variables example <a href=\"#selecting-data-into-multiple-variables-example\" class=\"anchor\" id=\"selecting-data-into-multiple-variables-example\" title=\"Anchor for Selecting data into multiple variables example\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>The following example fetches the names of customers and contacts from the <code>customers<\/code> and <code>contacts<\/code> tables for a specific customer id.<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">DECLARE<\/span>\r\n  l_customer_name customers.name<span class=\"hljs-meta\">%TYPE<\/span>;\r\n  l_contact_first_name contacts.first_name<span class=\"hljs-meta\">%TYPE<\/span>;\r\n  l_contact_last_name contacts.last_name<span class=\"hljs-meta\">%TYPE<\/span>;\r\n<span class=\"hljs-keyword\">BEGIN<\/span>\r\n  <span class=\"hljs-comment\">-- get customer and contact names<\/span>\r\n  <span class=\"hljs-keyword\">SELECT<\/span>\r\n    <span class=\"hljs-type\">name<\/span>, \r\n    first_name, \r\n    last_name\r\n  <span class=\"hljs-keyword\">INTO<\/span>\r\n    l_customer_name, \r\n    l_contact_first_name, \r\n    l_contact_last_name\r\n  <span class=\"hljs-keyword\">FROM<\/span>\r\n    customers\r\n  <span class=\"hljs-keyword\">INNER<\/span> <span class=\"hljs-keyword\">JOIN<\/span> contacts <span class=\"hljs-keyword\">USING<\/span>( customer_id )\r\n  <span class=\"hljs-keyword\">WHERE<\/span>\r\n    customer_id = <span class=\"hljs-number\">100<\/span>;\r\n  <span class=\"hljs-comment\">-- show the information  <\/span>\r\n  dbms_output.put_line( \r\n    l_customer_name || <span class=\"hljs-string\">', Contact Person: '<\/span> ||\r\n    l_contact_first_name || <span class=\"hljs-string\">' '<\/span> || l_contact_last_name );\r\n<span class=\"hljs-keyword\">END<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>Oracle issued the following output:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\">Verizon, Contact Person: Elisha Lloyd<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>In this example:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>First, declare three variables <code>l_customer_name<\/code>, <code>l_contact_first_name<\/code>, <code>l_contact_last_name<\/code> to hold the customer and contact&#8217;s names.<\/li>\r\n\r\n\r\n\r\n<li>Second, use the <code>SELECT INTO<\/code> statement to fetch the customer and contact names of the customer id 100 from the <code>customers<\/code> and <code>contacts<\/code> tables into the corresponding variables<\/li>\r\n\r\n\r\n\r\n<li><code>l_customer_name<\/code>, <code>l_contact_first_name<\/code>, <code>l_contact_last_name<\/code>.<\/li>\r\n\r\n\r\n\r\n<li>Third,\u00a0 display the customer and contact names.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='plsql-select-into-common-errors'>PL\/SQL SELECT INTO common errors <a href=\"#plsql-select-into-common-errors\" class=\"anchor\" id=\"plsql-select-into-common-errors\" title=\"Anchor for PL\/SQL SELECT INTO common errors\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>If the number of columns and expressions in the <code>SELECT<\/code> clause is greater than the number of variables in the <code>INTO<\/code> clause, Oracle issues this error:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">ORA<span class=\"hljs-number\">-00947<\/span>: not enough values The INTO <span class=\"hljs-keyword\">list<\/span> contains fewer variables than the SELECT <span class=\"hljs-keyword\">list<\/span>.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>Oracle issues the following error if the number of columns and expressions in the <code>SELECT<\/code> clause is less than the number of variables in the <code>INTO<\/code> clause:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">ORA<span class=\"hljs-number\">-00913<\/span>: too many values The INTO <span class=\"hljs-keyword\">list<\/span> contains more variables than the SELECT <span class=\"hljs-keyword\">list<\/span>.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>Suppose the number of variables and elements in the select list are the same, but their corresponding datatypes are incompatible. In that case, Oracle cannot implicitly convert from one type to another. It will issue the following error:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\">ORA<span class=\"hljs-number\">-06502<\/span>: PL\/<span class=\"hljs-keyword\">SQL<\/span>: <span class=\"hljs-type\">numeric<\/span> <span class=\"hljs-keyword\">or<\/span> <span class=\"hljs-keyword\">value<\/span> error<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Use the PL\/SQL <code>SELECT INTO<\/code> statement to fetch a single row from a table into variables.<\/li>\r\n<\/ul>\r\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"1520\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/\"\n\t\t\t\tdata-post-title=\"PL\/SQL SELECT INTO\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"1520\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/\"\n\t\t\t\tdata-post-title=\"PL\/SQL SELECT INTO\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows you how to use the PL\/SQL SELECT INTO statement to fetch data of a single row from a table into variables.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1418,"menu_order":14,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1520","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PL\/SQL SELECT INTO Statement<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use the PL\/SQL SELECT INTO statement to fetch data of a single row from a table into variables.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PL\/SQL SELECT INTO Statement\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use the PL\/SQL SELECT INTO statement to fetch data of a single row from a table into variables.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/\" \/>\n<meta property=\"og:site_name\" content=\"Oracle Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-25T01:53:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/contacts_customers_tables.png\" \/>\n\t<meta property=\"og:image:width\" content=\"354\" \/>\n\t<meta property=\"og:image:height\" content=\"165\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-select-into\\\/\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-select-into\\\/\",\"name\":\"PL\\\/SQL SELECT INTO Statement\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-select-into\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-select-into\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/contacts_customers_tables.png\",\"datePublished\":\"2017-11-23T14:09:44+00:00\",\"dateModified\":\"2025-05-25T01:53:40+00:00\",\"description\":\"This tutorial shows you how to use the PL\\\/SQL SELECT INTO statement to fetch data of a single row from a table into variables.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-select-into\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-select-into\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-select-into\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/contacts_customers_tables.png\",\"contentUrl\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/contacts_customers_tables.png\",\"width\":354,\"height\":165,\"caption\":\"PL\\\/SQL SELECT INTO example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-select-into\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.oracletutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PL\\\/SQL Tutorial\",\"item\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PL\\\/SQL SELECT INTO\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/\",\"name\":\"Oracle Tutorial\",\"description\":\"Oracle Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.oracletutorial.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PL\/SQL SELECT INTO Statement","description":"This tutorial shows you how to use the PL\/SQL SELECT INTO statement to fetch data of a single row from a table into variables.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/","og_locale":"en_US","og_type":"article","og_title":"PL\/SQL SELECT INTO Statement","og_description":"This tutorial shows you how to use the PL\/SQL SELECT INTO statement to fetch data of a single row from a table into variables.","og_url":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/","og_site_name":"Oracle Tutorial","article_modified_time":"2025-05-25T01:53:40+00:00","og_image":[{"width":354,"height":165,"url":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/contacts_customers_tables.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/","url":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/","name":"PL\/SQL SELECT INTO Statement","isPartOf":{"@id":"https:\/\/www.oracletutorial.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/#primaryimage"},"image":{"@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/#primaryimage"},"thumbnailUrl":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/contacts_customers_tables.png","datePublished":"2017-11-23T14:09:44+00:00","dateModified":"2025-05-25T01:53:40+00:00","description":"This tutorial shows you how to use the PL\/SQL SELECT INTO statement to fetch data of a single row from a table into variables.","breadcrumb":{"@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/#primaryimage","url":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/contacts_customers_tables.png","contentUrl":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/contacts_customers_tables.png","width":354,"height":165,"caption":"PL\/SQL SELECT INTO example"},{"@type":"BreadcrumbList","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-select-into\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.oracletutorial.com\/"},{"@type":"ListItem","position":2,"name":"PL\/SQL Tutorial","item":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/"},{"@type":"ListItem","position":3,"name":"PL\/SQL SELECT INTO"}]},{"@type":"WebSite","@id":"https:\/\/www.oracletutorial.com\/#website","url":"https:\/\/www.oracletutorial.com\/","name":"Oracle Tutorial","description":"Oracle Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.oracletutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/1520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/comments?post=1520"}],"version-history":[{"count":0,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/1520\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/1418"}],"wp:attachment":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/media?parent=1520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}