本文介绍了序列的PostgreSQL nextval问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试在PHP中使用postgresql的 nextval。如何在第三行中填写括号,以便用nextval('schemadb.audit_txn_seq')的值替换TXN_ID?I am trying to work with postgresql 'nextval' in PHP. How can I fill in the parenthesis in the third line in order to replace TXN_ID with the value of nextval('schemadb.audit_txn_seq')?$DB->query("SELECT nextval('schemadb.audit_txn_seq')");$DB->query('SET CONSTRAINTS ALL DEFERRED');$DB->query('SELECT schemadb.undo_transaction(TXN_ID)');谢谢!推荐答案您没有告诉我们什么是 $ DB 变量。我猜您正在使用PDO。You did not tell us what is $DB variable. I guess you are using PDO.是否有将查询结果存储到php变量中的问题是一种初学者的问题,在手册。The question "Is there anyway to store the result of query into php variable" is kind of beginner question, and is easilly answered in the manual.您必须了解,(从PHP的角度来看)You must understand, that (from PHP's point of view) there is no difference betweenSELECT nextval('schemadb.audit_txn_seq')和SELECT xcolumn FROM xtable LIMIT 1如果要从中获取数据值任何查询都以相同的标准方式执行:If you want to fetch data values from ANY query, you do it always the same, standard way: query execute 获取希望有帮助。 这篇关于序列的PostgreSQL nextval问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-27 04:36
查看更多