update multiple rows in oracle

update multiple rows in oracle specifying a list

UPDATE TABLE_NAME
  SET STATUS = 'Y'
    WHERE SEX = 'M'
    AND INC_DATE = TO_DATE('20180530', 'YYYYMMDD')
    AND FISRT_NAME IN ('MICKEY', 'DONALD', 'PATETA');
Advertisements

format output on sqlplus oracle

using TAB as field separator

echo "
SET HEADING ON
SET FEEDBACK OFF 
SET PAGESIZE 0 EMBEDDED ON 
SET ECHO OFF
SET LINESIZE 10000 
SET TAB OFF
SET COLSEP '$(echo -ne "\t")'
SET NULL _
ALTER SESSION SET NLS_DATE_FORMAT = 'YYYYMMDD';

SELECT ...
" | sqlplus -S user/password@hostname:port/service_name

using PIPE as field separator

echo "
SET HEADING ON
SET FEEDBACK OFF 
SET PAGESIZE 0 EMBEDDED ON 
SET ECHO OFF
SET LINESIZE 10000 
SET TAB OFF
SET COLSEP '|'
SET NULL _
ALTER SESSION SET NLS_DATE_FORMAT = 'YYYYMMDD';

SELECT ...
" | sqlplus -S user/password@hostname:port/service_name