我正在Postgresql中try CHARINDEX个.但它说:

function CHARINDEX() does not exist

如果postgresql中不存在这样的内置函数,那么是否有任何函数可以替代charindex?

推荐答案

postgresql中的等效函数是:

strpos(string, substring)

或者:

position(substring in string)

它们是等价的,只是参数的顺序不同.

你可以在:https://www.postgresql.org/docs/current/functions-string.html中找到它们

Postgresql相关问答推荐

如何删除Devtainer之前创建的PostgreSQL数据库?

在 Postgres 中,部分索引比普通索引需要更多的时间和成本来执行

如何将 jackc/pgx 与连接池、上下文、准备好的语句等一起使用

使用 pgAdmin 4 v7.4 在 Windows 11 上全新安装 PostgreSQL 15.3-3 无法启动 - 卡在正在加载 pgAdmin 4 v7.4...

PostgresQL:获取两个数组之间的对应数量

PostgreSQL 输入结束时的语法错误

处理 sqlalchemy 断开连接的更好方法

PostgreSQL 提示:You will need to rewrite or cast the expression. column "state" is of type status but expression is of type character varying

sql语句错误:column .. does not exist

postgresql 分组和内部连接

postgresql:致命:password authentication failed for user "douglas"

如何使用 node-postgres 将多行正确插入 PG?

如何判断 PostgreSQL 事务中的待处理操作

使用枚举与布尔值?

Postgres Npgsql 连接池

Postgresql - 更新规则 - 可能有一个最后修改日期,自动更新该行的on update?

使用 RPostgreSQL 写入特定模式

PGAdmin 编辑数据

在 PGAdmin 中搜索所有功能的文本

如何查询前 10 行,下一次从表中查询其他 10 行