Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to determine whether a string contains a picture format by the oracle function

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how the oracle function determines whether the string contains a picture format. Xiaobian thinks it is quite practical, so share it with you as a reference. I hope you can gain something after reading this article.

The first is to write a function that splits a string and returns a table type.

CREATE OR REPLACE FUNCTION fn_split (p_str IN VARCHAR2, p_delimiter IN VARCHAR2)RETURN ty_str_splitIS j INT := 0; i INT := 1; len INT := 0; len1 INT := 0; str VARCHAR2 (4000); str_split ty_str_split := ty_str_split ();BEGIN len := LENGTH (p_str); len1 := LENGTH (p_delimiter); WHILE j

< len LOOP j := INSTR (p_str, p_delimiter, i); IF j = 0 THEN j := len; str := SUBSTR (p_str, i); str_split.EXTEND; str_split (str_split.COUNT) := str; IF i >

= len THEN EXIT; END IF; ELSE str := SUBSTR (p_str, i, j - i); i := j + len1; str_split.EXTEND; str_split (str_split.COUNT) := str; END IF; END LOOP; RETURN str_split;END fn_split;

The above function can split the string and return it to table

create or replace function fn_ispng( strpng in varchar2 ) return number is v_num number;begin WITH t1 AS (select * from table (fn_split(strpng,'. ')) ) select count(1) into v_num from t1 where t1.column_value in ('png', 'jpg','jpeg','gif','bmp','eps'); return v_num;end fn_ispng;

The above is to determine whether it is a picture format, the picture format returns 1

select fn_ispng('dfdfd.png') From dual; About "oracle function how to determine whether the string contains image format" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report