Oracle函数-高阶篇
下面整理了部分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的用法区别及性能比较
本文永久更新链接地址:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

JSON data can be saved into a MySQL database by using the gjson library or the json.Unmarshal function. The gjson library provides convenience methods to parse JSON fields, and the json.Unmarshal function requires a target type pointer to unmarshal JSON data. Both methods require preparing SQL statements and performing insert operations to persist the data into the database.

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.
