relation with OID 637165 does not exist
執行儲存報錯物件表不存在,而且這個OID還會變,儲存中有段如下程式碼,迴圈刪除、刪除並使用同一個臨時表表名,猜測和臨時表有關 。查詢資料得知PostgreSQL版本<8.3(GP4.3.8是pg8.2引擎),如果一個PL / pgsql函式訪問一個臨時表,然後這個臨時表刪除並重新建立,並再次呼叫,該函式會失敗,因為快取的功能內容仍指向老 臨時表
dt:='2015-11-01 00:00:00'::date;
while dt<now() loop
drop table if EXISTS t3;
create TEMPORARY table t3 as (
select test.*
,SUM(amount) OVER (PARTITION BY user_id ORDER BY date) AS s1
from test
where date<dt
);
drop table if EXISTS t4;
create TEMPORARY table t4 as (
select user_id,sum(-amount) as amount
from test
where date<dt GROUP BY user_id
);
INSERT INTO equ
select t3.user_id,t3.date as BEGIN,null as end,case when s1-t4.amount<t3.amount then s1-t4.amount else t3.amount end,3 as flag
from t3 left join t4
on t3.user_id=t4.user_id and t3.s1>t4.amount where to_number(date,'9999999')=to_number(dt,'9999999');
dt:=dt + INTERVAL '1 month';
end loop;
把臨時表換成子查詢解決
dt:='2015-11-01 00:00:00'::date;
while dt<now() loop
INSERT INTO equ
select t3.user_id,t3.date as BEGIN,null as end,case when s1-t4.amount<t3.amount then s1-t4.amount else t3.amount end,3 as flag
from
(
select test.*
,SUM(amount) OVER (PARTITION BY user_id ORDER BY date) AS s1
from test
where date<dt
) t3 left join
(
select user_id,sum(-amount) as amount
from test
where date<dt GROUP BY user_id
)t4
on t3.user_id=t4.user_id and t3.s1>t4.amount where to_number(date,'9999999')=to_number(dt,'9999999');
dt:=dt + INTERVAL '1 month';
end loop;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29989552/viewspace-2128284/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- asmcmd does not exist in directoryASM
- javax.media does not existJava
- pgsql 執行建庫指令碼時候出現ERROR: relation "xxx_id_seq" does not existSQL指令碼Error
- Property [title] does not exist on this collection instance
- Waring: /dev/centos/swap does not existdevCentOS
- PatchObject constructor:Input file does not existObjectStruct
- PSQLexception: ERROR : type "signed" does not existSQLExceptionError
- Laravel Class env does not exist 問題排查Laravel
- SNMP TABLE ERROR : Requested table is empty or does not existError
- ORA-00942: table or view does not existView
- FAQ:Field DATABASE does not exist; see long textDatabase
- ORA-04043: object DBA_DATA_FILES does not existObject
- ORA-04042 procedure, function, package, or package body does not existFunctionPackage
- ORA-24756: transaction does not exist問題解決
- 【Oracle】-【許可權-ORA-04043】- object does not existOracleObject
- PL/SQL: ORA-00942: table or view does not existSQLView
- ORA-12545 TNS: Host or Object Does not ExistObject
- Property 'context' does not exist on type 'NodeRequire'.ts(2339)ContextUI
- The user specified as a definer ('wx_root'@'%') does not exist 解決方案
- MySQL 5.7啟動資料庫報錯'does not exist or is not executable'MySql資料庫
- mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解決方法MySql
- org.apache.maven.plugins:maven-archetype-plugin does not existApacheMavenPlugin
- 模擬ORA-04043並解決(dba_* does not exist)
- The subkey 'HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesAVP' does not exist on the 'localhost'Maclocalhost
- dcat-admin 表單 Field type [autocomplete] does not exist.
- yii2接入pgSQL(查詢不到表The table does not exist: {{%user}})SQL
- oracle for linux安裝報錯 file /home/oracle/.Xauthority does not existOracleLinux
- expdp ORA-31626: job does not exist 解決方案
- imp 時出現在ORA-00942: table or view does not existView
- 靜默安裝Oracle建庫時報Template General Purpose does not existOracle
- The operation, ‘DecodeJpeg/contents‘, does not exist in the graph.錯誤解決方法
- Oracle ORA - 01720 grant option does not exist for..報錯解決Oracle
- job呼叫過程報錯 ORA-00942: table or view does not existView
- ORA-12545: Connect failed because target host or object does not existAIObject
- from v * ERROR at line 1: ORA-00942: table or view does not existErrorView
- The file '/MasterPage.master' does not exist. 類錯誤解決方法AST
- IMP 時的 ORA-01435 user does not exist 處理
- Error: The directory named as part of the path ./log/supervisord.log does not exist解決方案Error