简体   繁体   中英

How to skip errors when using json_extract_path_text in Redshift?

I have the following query:

SELECT 'curl -s http://www.mde.operator.com/MRE/api?profile=CANCEL_AUTH&mode=assync-oneway&Auth='||json_extract_path_text(external_reference_id,'transactionIdAuth') + '&NUM=' + phone  FROM dbo.cancelled WHERE id like '%Auth%';

It will bring more than 60 thousands results, but the json is broken and I cannot manage to delete the broken lines.

Is there any way to skip the rows which shows any kind of errors?

Note: It isn't null rows.

I've already try:

json_extract_path_text(regexp_replace(event_properties,'\\\\.',''),'someValue')

You can make them null rows though, by setting the null_if_invalid argument of the json_extract_path_text function to true .

Source: https://docs.aws.amazon.com/redshift/latest/dg/JSON_EXTRACT_PATH_TEXT.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM