search
HomeDatabaseMysql TutorialOracle函数-高阶篇

下面整理了部分Oracle函数-高阶篇: 1、 CATSTR 举例:SELECT CATSTR(COLUMN_NAME) NAME_LIST FROM DBA_TAB_COLUMNS WHERE TR

下面整理了部分Oracle函数-高阶篇:

1、 CATSTR
    举例:SELECT CATSTR(COLUMN_NAME) NAME_LIST FROM DBA_TAB_COLUMNS WHERE TRIM(TABLE_NAME) = 'T_RZ_DKDATA'  --查询出的结果在一个列中
2、 INSTR() 检索字符串函数:匹配则返回首次检索的位置的索引值(从1开始),值>0,否则返回值=0
    举例:SELECT * FROM USER_TABLES WHERE INSTR(TABLE_NAME,'T_RZ_')>0 --查询表名中包含'T_RZ_'字符的表
    举例:SELECT INSTR('abcdehfghjk','h') FROM dual; --返回h首次出现的索引位置,返回值=6
3、 replace(str,searth_str,[replace_str])字符串替换函数:
    str:目标字符串;
    searth_str:指定要查找的字符串
    replace_str:用来替代查找匹配的字符串,无该参数时,查找到的searth_str都将被删除
    例如: SQL> SELECT REPLACE('yaddsfsfsa','d') FROM dual;
                REPLACE('YADDSFSFSA','D')
                -------------------------
                yasfsfsa
          SQL> SELECT REPLACE('yaddsfsfsa','d') FROM dual;
                REPLACE('YADDSFSFSA','D','1')
                -------------------------
                ya11sfsfsa
4、 CONCAT(str1,str2)字符串连接,类似于|| ,举例:SELECT CONCAT('str1','str2') FROM DUAL --得到结果:str1str2
5、 INITCAP(str)返回字符串:第一个字母大写 而其他字母小写。
6、 LPAD(string, padded_length, [ pad_string ]) --在字段或字符string左侧填充字符pad_string或空格,填充后的长度为padded_length
    举例:SQL> SELECT LPAD('A',2,'B'),RPAD('A',2,'B') FROM dual;
              LPAD('A',2,'B') RPAD('A',2,'B')
              --------------- ---------------
              BA              AB
7、 reverse(str)字符串反转函数
    举例:SELECT REVERSE('abcdefghjk') FROM dual; --结果为:kjhgfedcba
8、 translate(string,from_string,to_string)函数:是一种通过字符集转换来修改字符串的函数
    string:目标字符串;
    from_string:想要转换的字符集;
    to_string:将替代from_string 的新字符集,目标字符串string中的每个from_string字符都被to_string字符中的对应字符替换,若from_string的字符在to_string中没有对应的字符,则在目标字符串中将该字符删除。
    举例:
    SQL> SELECT TRANSLATE('QWER.1233430004','0123456789.','abcdefghij') FROM dual;
        TRANSLATE('QWER.1233430004','0
        ------------------------------
        QWERbcddedaaae
9、 sign(number)函数:number为负数、0、正数时对应的返回值分别为-1,0,1,常和sum()一起使用
10、floor(value) 函数:返回小于等于value的最大整数,,SELECT FLOOR(-9.612727) FROM dual;  ---返回值为-10
11、greatest(expr,[expr,……])函数:返回参数列表中的最大值,可用于 数字、字符串和日期比较
    least(expr,[expr,……])函数:返回参数列表中的最小值,可用于 数字、字符串和日期比较,与greatest()相反

Oracle函数之GREATEST函数详解实例

Oracle函数之单行转换函数

生成动态前缀且自增号码的Oracle函数

Oracle函数之Replace()

Oracle函数大全

Oracle函数之case和decode的用法区别及性能比较

本文永久更新链接地址:

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Atom editor mac version download

Atom editor mac version download

The most popular open source editor