Skip to content

Instantly share code, notes, and snippets.

@rashivkp
Last active August 29, 2015 14:27
Show Gist options
  • Save rashivkp/df7715f9d486796fd6e5 to your computer and use it in GitHub Desktop.
Save rashivkp/df7715f9d486796fd6e5 to your computer and use it in GitHub Desktop.
Make a oracle sql compatible with mysql by removing unwanted lines
:g/\v^Insert into DISE2K_|^Insert into STEPS_R|^Insert into CHK_TABLE|^Insert into RTE_COMPLAINT|^Insert into SCH_TEMP|^Insert into SCH_TEMP1|^Insert into STEPS_AUTH|^Insert into STEPS_CWSNCHILDDB|^Insert into STEPS_DATE|^Insert into STEPS_DBINFO|^Insert into STEPS_DCF2PRINT|^Insert into STEPS_DISTPHASE|^Insert into STEPS_PIVOT|^Insert into STEPS_POP4COMPRATE|^Insert into STEPS_POPULATION_ALL|^Insert into STEPS_PRINTDCF|^Insert into STEPS_QUERY|^Insert into STEPS_RMSASUBJECTS|^Insert into STEPS_R_ANAREPBYMCR|^Insert into STEPS_R_ANAREPINFO|^Insert into STEPS_R_ENRBYMCR_SCR|^Insert into STEPS_R_EREPBYMCR|^Insert into STEPS_R_REPINFO|^Insert into STEPS_R_SCHGRADE|^Insert into STEPS_R_SREPBYMCR|^Insert into STEPS_R_TREPBYMCR|^Insert into STEPS_SCHBYCATMGT|^Insert into STEPS_SCHGRADING|^Insert into STEPS_TEACHER_RTE|^Insert into STEPS_TEHSIL|^Insert into STEPS_TOTDISABILITY|^Insert into STEPS_TOTENROLMENT|^Insert into STEPS_TOTPINCENTIVES|^Insert into STEPS_TOTUINCENTIVES/d
:g/^--/d
:g/^ ALTER TABLE/d
:g/^ UNIQUE INDEX/d
:g/^ CREATE /d
:g/^ Select/d
:g/^ SELECT/d
:%s/\r/\r/g
:g/^REM INSERTING/d
:g/VARCHAR2([0-9]*)/d
:g/CHAR([0-9]*)/d
:g/NUMBER([0-9]*,[0-9]*)/d
:g/\vNUMBER,|NUMBER$/d
:g/ DATE,/d
:g/ ) ;/d
:%s/\r/\r/g
:g/^ ;/d
:g/^$/d
:%s/to_timestamp(\('.*'\),'.*')/STR_TO_DATE(\1,'%d-%M-%Y')/g
:w
:g/^$/d
:wq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment