Search code examples
sqloracle-databasecsvtextpad

Workaround inside IN OPERATOR


ALERT
ALERTING_TRANSACTION
ALERTING_TRANSACTION_LINK
ALERT_ACTION_LOG
ALERT_ALERT
ALERT_ASSIGNMENT
ALERT_CASE
ALERT_CUSTOMER
ALERT_DOCUMENT
ALERT_EXT
ALERT_MATCH
ALERT_MATCH_DATA
ALERT_RESTRICTION
ALERT_STATUS
ALERT_TRANSACTION
A_ALERT
A_ALERTING_TRANSACTION
A_ALERT_ACTION_LOG
A_ALERT_ASSIGNMENT
A_ALERT_CASE
A_ALERT_MATCH
A_ALERT_MATCH_DATA
AUDIT_LOGS
CASES
CASE_ACTION_LOG
CASE_CUSTOMER
CASE_DIARY
CASE_DOCUMENT
CASE_EXT
CASE_NARRATIVE
CASE_TRANSACTION
CHANNEL_SUBSCRIPTIONS
COUNTRY
CURRENCY
CUSTOMERS
CUSTOMERS_RANGE
CUSTOMER_AUDIT_LOG
CUSTOMER_PROFILE
CUSTOMER_STATUSES
CUSTOM_TRANSACTION_FIELD
DF_ACCOUNT
DF_ACTIVITY_TYPE
DF_ASSISTANCE_CONTACT
DF_AUTH_SIGN_PART
DF_CHECKBOX_FINTRAC
DF_CUSTOMER
DF_DISC
DF_DISCLOSURE_AUSTRAC_SMR
DF_DISCLOSURE_CANFINTRAC_31
DF_DISCLOSURE_LUXEMBOURGSTR
DF_DISCLOSURE_USFINCEN_109
DF_DISC_TYPE
DF_DISC_VERSION
DF_EFILE_BATCH
DF_FINTRAC_INSTITUTE
DF_HONGKONG_INSTITUTION
DF_INSTITUTION_AUSTRAC
DF_LAW_ENFORCEMENT_AGENCY
DF_NARRATIVE
DF_REGULATORY_CONTACT

I have these records in a text file. I want to write a query like

SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME NOT IN ('ALERT','ALERTING_TRANSACTION',.....,'DF_REGULATORY_CONTACT')

Can anybody tell me how can I add '' around each table name and separate the table_names by , inside the IN OPERATOR as the list of tables is veryyyyyy long.


Solution

  • Use your favorite text editor to replace line begin (^ in regular expression) with ' and line end ($ in regular expression) with ',. Remove the last , and you have a list to put inside the ( ).

    EDIT

    If your favorite text editor doesn't support regular expression, get one that does. It would be great addition to your tool list (for one off such as this) even if you continue to use your favorite text editor that doesn't support regular expression for day-today text editing.