select stringreplace(
由于开发需要,想实现一些提示信息的通用,,比如,提示信息内容:“XXX的值YYY不正确,请检查并重新输入!”,那么,通用的信息内容就应该为:“{0}的值{1}不正确,请检查并重新输入!”。但这个“{0}”和"{1}"怎么替换掉呢?在.net中,字符串有String.Format函数,这样我们就可以很容易地去根据不同的内容,替换成不一样的内容,但Oracle里面还没有样的函数(据个人所知,不知道有没有孤漏寡闻!),但又想用,所以就只能自己写了。
想了想,有问题啊,且听我道来:
信息内容中有多个参数,并且都是用花括号中带数字来表示,如{0},{1},{2},那么,这些参数最好能用数组来表示,但Oracle PL/SQL中有数组吗?都怪自己平时不努力,书到用时方恨少啊。在网上百谷了一下,Oralce里面没有现成的数据类型,只有通过自定义数组类型(其实是Table表结构类型).如下代码所示:
可是问题又来了,用的时候,怎么传值给函数啊?杯具了,纠结了好一会,算了,还是笨一会吧,字符串分割好了。那么这个函数需要什么东东呢?
1.信息内容
2.参数列表(多个参数用分割符分开)
3.分割符(当然是跟2中一致的,不然,可就牛头不对马嘴了)
开始写吧,转头一想,是不是分成两个函数会更好呢?一个用于分割返回参数数组列表,另一个专就是调用分割函数得到参数列表后,做替换的动作,最后返回。en,想想不错,就写成两个吧,功能很单纯,很天真。
俗话说,他山之石,可以攻玉。百谷了一下,分割函数有现成的,拿来吧,请往下看:
1 RETURN returnvalue;
44 END stringsplit;

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

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.

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
