title: Run sql code with variables in Oracle SQL Developer code window
body: <p>I'm writing code using Oracle SQL Developer. I have a simple select statement that works:</p>
  
  <pre><code>    SELECT
        CFS.CAE_SEC_ID,
        CFS.FM_SEC_CODE,
        CFS.LAST_USER_ID,
        case 
            when 1 = 1 then
              sl.usbank_to_edit
            else
              case 
                when 'ENT\CB174' = CFS.last_user_id then
                  sl.owner_to_edit
                else
                  sl.to_edit
              end
          end canEdit
      FROM
      CAEDBO.CAE_FOF_SECURITY CFS
      INNER JOIN caedbo.CAE_DATA_SET_ELEMENT CDSE_STAT 
          ON (CDSE_STAT.DATA_SET_ELEMENT_ID = CFS.APPR_STATUS)
      INNER JOIN caedbo.CAE_STATE_LOOKUP sl 
          ON (sl.object_state =  CDSE_STAT.data_set_element_id)
     where 
        cfs.CAE_SEC_ID in (3741, 3744, 3748, 3752);
  </code></pre>
  
  <p>However I want to add some variables to it and reference the variables in the statement, similar to below, and also run it in the code window. How do I do this correctly?</p>
  
  <pre><code>DECLARE 
    p_USBank_n NUMBER;
    p_user_id_c VARCHAR2(20);
  BEGIN  
    p_USBank_n := 1; 
    p_user_id_c := 'ENT\CB174';
  
      SELECT
        CFS.CAE_SEC_ID,
        CFS.FM_SEC_CODE,
        CFS.LAST_USER_ID,
        case 
            when p_USBank_n = 1 then
              sl.usbank_to_edit
            else
              case 
                when p_user_id_c = CFS.last_user_id then
                  sl.owner_to_edit
                else
                  sl.to_edit
              end
          end canEdit
      FROM
      CAEDBO.CAE_FOF_SECURITY CFS
      INNER JOIN caedbo.CAE_DATA_SET_ELEMENT CDSE_STAT 
          ON (CDSE_STAT.DATA_SET_ELEMENT_ID = CFS.APPR_STATUS)
      INNER JOIN caedbo.CAE_STATE_LOOKUP sl 
          ON (sl.object_state =  CDSE_STAT.data_set_element_id)
     where 
        cfs.CAE_SEC_ID in (3741, 3744, 3748, 3752);
  END;
  </code></pre>
  
  <p>When I run this in a sql window I get the message below:</p>
  
  <pre><code>Error report:
  ORA-06550: line 8, column 5:
  PLS-00428: an INTO clause is expected in this SELECT statement
  06550. 00000 -  "line %s, column %s:\n%s"
  *Cause:    Usually a PL/SQL compilation error.
  *Action:
  </code></pre>