pg select中使用变量
DO $$ DECLARE myvar int8; BEGIN --SELECT 168038292783239160 INTO myvar; myvar=168038292783239168; DROP TABLE IF EXISTS tmp_table; CREATE TABLE tmp_table AS select * from ess_storehouseini es where s_storages_id= myvar; END $$; SELECT * FROM tmp_table;