oracle11g

how to call the stored procedure in oracle with the daily scheduled jobs?

爱⌒轻易说出口 提交于 2019-12-22 08:48:57
问题 I am new to the oracle job scripts. I wrote some purge procedure to clean all the old data and retain the last 3 months data... procedure is executed successfully. its working when im calling manually also. procedure is as follows: CREATE OR REPLACE PROCEDURE Archive IS v_query varchar2(2048); v_tablename VARCHAR2(50); v_condition varchar2(50); TYPE cur_typ IS REF CURSOR; c cur_typ; BEGIN OPEN c for 'select tablename,columnname from pseb.purge_tables'; FETCH c INTO v_tablename,v_condition;

Error casting T4CConnection to OracleConnection

。_饼干妹妹 提交于 2019-12-22 08:46:26
问题 Spring application using JNDI lookup to get datasource as following: @Bean(name = "dataSource1", destroyMethod = StringUtils.EMPTY) public DataSource dataSource() { final JndiDataSourceLookup lookup = new JndiDataSourceLookup(); lookup.setResourceRef(true); return lookup.getDataSource(this.environment.getProperty(Constants.DB_JNDI_NAME_ES)); } and getting a connection from the datasource as follows : @Autowired @Qualifier("dataSource1") private DataSource ds; Connection conn = null; conn =

Passing dynamic input parameters to 'execute Immediate'

ⅰ亾dé卋堺 提交于 2019-12-22 08:44:54
问题 I have a table where I am storing certain conditions along with input parameters as shown below: CONDITION | INPUT_PARAMS --------------------------------------------------------- :p_end_date < :p_start_date | v_end_date, IN v_start_date :p_joining_day = 'MONDAY' | v_joining_day I want to use execute immediate to evaluate the conditions. select condition, input_param into v_execute_condition, v_input_param From table; v_execute_statement := 'IF '||v_execute_condition ||' '|| 'THEN :o_flag :=

Deferred Segment Creation feature not enabled (ORA-00439)

偶尔善良 提交于 2019-12-22 08:19:56
问题 I have .sql script file with DDL for more than 60 tables. I am trying to copy-paste the script into SQL Developer, connected to a database which is "Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production". Sample DDL Script: CREATE TABLE UserName."Table_Name" ( "Col1" NUMBER(*,0), "Col2" VARCHAR2(50 BYTE), "Col3" VARCHAR2(50 BYTE) ) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE "USERS" ; Error report - SQL Error: ORA

How to use oracle client 11.2 with php (xampp) on win7 x64

放肆的年华 提交于 2019-12-22 08:17:53
问题 I just installed an acutal XAMPP on my win7 (x64) PC to write some PHP scripts to connect to an oracle DB. I also have a normal oracle 11.2.0 client installed (PATH and ORACLE_HOME are set correctly). The client is used for all my other work without any problems. When I try to connect to an oracle DB PHP fails with Fatal error: Call to undefined function oci_connect() in . I remember I had to enable the "oci8-extensions" in my php.ini when I did the same thing some years ago on a x32 winXP PC

How to handle the loss of precision on JDBC numeric types due to grouping functions

百般思念 提交于 2019-12-22 08:08:29
问题 Oracle (and some other DB's) have a datatype NUMBER, with which one can optionally set the precision and scale. Suppose the below query: SELECT agent_code, AVG (opening_amt) FROM customer GROUP BY agent_code; If both fields in above query were defined as NUMBER(12,0), the result in JDBC is indeed that for agent_code, but on "AVG(opening_amt)" both precision and scale return 0 (via java.sql.ResultSetMetaData.getPrecision(col) and java.sql.ResultSetMetaData.getScale(col) . That's basically the

Should I partition/subpartition my table?

人走茶凉 提交于 2019-12-22 06:56:33
问题 Case The system has dispositives , basically formed by id, type, name . I may have N dispositives . I have a table to store a log of all dispositives . This is the biggest table in the system. (Now counting 100 mi records) The log table has: id_dispositive, date, status . Problem Obviously this huge data it's causing performance issues. I must store at least two months log values.. Today I have this dispositives by type : TYPE COUNT --------------- 1 78956 2 125161 3 13213 4 6112 5 25426 6

Oracle direct-load INSERTs through JDBC?

前提是你 提交于 2019-12-22 06:50:15
问题 Is it possible to do direct-load INSERTs in Oracle through JDBC? I currently use batched prepared statements (through Spring JDBC), is there any way to make these bypass the redo logs on a NOLOGGING table? This is with Oracle 11g. 回答1: There is an APPEND_VALUES hint introduced in 11gR2 for direct path inserts with INSERT...VALUES. Don't have an 11gR2 instance available to test whether it works with JDBC batch inserts. It is worth a try though. 回答2: direct path inserts are only possible in a

How to query for a primary key in oracle 11g

女生的网名这么多〃 提交于 2019-12-22 06:47:06
问题 Does anybody know how to query for a primary key of a table in Oracle 11g? I saw a similar question for SQL Server, but I've had no luck from trying the answers on that thread. Thanks! 回答1: As the user that owns the table you can do: select constraint_name, status, deferrable, deferred, validated, generated from user_constraints where constraint_type = 'P' and table_name = 'Table Name' Update: I think this gets you what you need. SELECT cols.table_name, cols.column_name, cols.position, cons

Timestamp calculation with daylight saving time

只谈情不闲聊 提交于 2019-12-22 05:20:15
问题 The Central European Daylight Saving Time begins on last Sunday in March. We set our clocks from 02:00 to 03:00. What happens if I do timestamp calcuations in a database request - lets say at 01:59? UPDATE sessions SET aliveuntil = (CURRENT_TIMESTAMP + INTERVAL '1' MINUTE) WHERE id = ? Do I get 03:00 as result or 02:00? And what about the over way around if we set our clocks from 03:00 to 02:00? SELECT id FROM sessions WHERE aliveuntil < (CURRENT_TIMESTAMP - INTERVAL '1' MINUTE) After time