简体   繁体   中英

Migrating PostgreSQL into Oracle, Boolean compatibility

I have one table called Table A , It has three fields aa ab ac . ac is Boolean in PostgreSQL, while migrating to oracle db I have made it Number(1) . But In Back-end code I have written SQL queries like SELECT * FROM A where ac = true . Without changing the SQL query I wanted to get data from oracle db . Please let me know it is possible or not. If possible then which approach should I follow.

You will have to change the SQL (code). No other way around it. Boolean is not supported in Oracle SQL.

如果服务是 python,我建议你在 PostgreSQL 中将其保留为整数,并在检查约束中仅接受 0 或 1。在 ORM 中映射 ie 时,您可以将int(False)用于 0,将int(True)用于 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM