I am trying to convert the below Oracle sql to postgres sql:
Update Table_name set flag='U' WHERE id= 1 and ROWNUM < 2.
if the data in the table is some thing like
Then the query should update only one record as Unique like flag='U'.. and other records should not be effected.
Note:There is no unique key nor primary key on the table. I don't have access rights to create a constraint.
Since ROWNUM is not available in postgres, I am not able to do convert this query into postgres.
Thanks in advance..
You can use the pseudo column CTID here -
Update Table_name
SET flag='U'
WHERE CTID IN (SELECT CTID FROM Table_name WHERE id = 1 LIMIT 1);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.