oracle11g

pragma autonomous_transaction in a trigger

谁说我不能喝 提交于 2019-12-04 09:21:15
I have written a trigger on one table which deletes data from other table upon a condition. The trigger has pragma autonomous_transaction, and trigger works as intended. However, I do wonder if there can be any problems in future, say if data is inserted by multiple users/sources at the same time etc...Any suggestions? Source table t1: -------------------------------------------- | user_id | auth_name1 | auth_name2 | data | -------------------------------------------- | 1 | Name1 | Name2 | d1 | | 2 | Name3 | Name4 | d2 | | 3 | Name5 | Name1 | d3 | --------------------------------------------

ClassCastException in JPA Entitiy after redeploy (Glassfish 3.1.2)

老子叫甜甜 提交于 2019-12-04 08:24:42
I have a strange effect when undeploying and deploying a WebArchive (.war) with Glassfish 3.1.2. $ asadmin undeploy myWebApp; asadmin deploy target/myWebApp.war It deploys normally, but when I fetch an entity bean via the entity manager, it throws an Exception: [#|2012-12-11T15:26:09.772+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=119;_ThreadName=Thread-2;|java.lang.ClassCastException: org.YourEntity cannot be cast to org.YourEntity The exception is thrown in the q.getSingleResult() call. @PersistenceContext(unitName = "org.my-PU") private

ODP.net managed driver throws ORA-12570: Network Session: Unexpected packet read error

﹥>﹥吖頭↗ 提交于 2019-12-04 08:06:32
问题 In one of our products we retrieve data from the Oracle database using stored procedures using the ODP.net managed driver. Every now and then (roughly every 1000 queries) we get the following exception: (ORA-12570: Network Session: Unexpected packet read error) ---> Oracle.ManagedDataAccess.Client.OracleException: ORA-12570: Network Session: Unexpected packet read error ---> OracleInternal.Network.NetworkException: ORA-12570: Network Session: Unexpected packet read error ---> System

Recursive Insert using connect by clause

冷暖自知 提交于 2019-12-04 07:51:21
I have hierarchical data (right) in table in following manner which creates Hierarchy as shown in left. Tables are kept in oracle 11g. TREE Hierarchy Tree Table -------------- Element Parent ------ ------ P0 P0 P1 P1 P0 P11 P2 P0 C111 P11 P1 C112 P12 P1 P12 P21 P2 C121 P22 P2 C122 C111 P11 P2 C112 P11 P21 C121 P12 C211 C122 P12 C212 C211 P21 P22 C212 P21 C221 C221 P22 C222 C222 P22 My data table has values as follows. It contains values for all leaf nodes. Data Table Element Value C111 3 C112 3 C121 3 C122 3 C211 3 C212 3 C221 3 C222 3 P11 6 I need to generate insert statement, preferably

Using SQL LOADER in Oracle to import CSV file

倖福魔咒の 提交于 2019-12-04 07:29:55
I'm pretty new to databases and programming. I'm not very good with the computer lingo so stick with me. I have a csv file that I'm trying to load into my Oracle database. It contains account information such as name, telephone number, service dates etc. I've installed Oracle 11g Release 2 . This is what I've done so far step by step.. 1) Ran SQL Loader I created a new table with the columns that I needed. For example create table Billing ( TAP_ID char(10), ACCT_NUM char(10), MR_ID char(10), HOUSE_NUM char(10), STREET char(30), NAME char(50) 2) It prompted me that the Table was created. Next I

Update query resulting wrongly

拟墨画扇 提交于 2019-12-04 07:15:38
问题 I have table called company_emp . In that table I have 6 columns related to employees: empid ename dob doj, ... I have another table called bday . In that I have only 2 columns; empid and dob. I have this query: select empid, dob from company_emp where dob like '01/05/2011' It shows some list of employees. In the same way I have queried with table bday it listed some employees. Now I want to update the company_emp table for employees who have date '01/05/2011'. I have tried a query like this:

Not able to use LISTAGG

喜你入骨 提交于 2019-12-04 07:11:09
问题 SELECT deptno, LISTAGG(ename, ',') WITHIN GROUP (ORDER BY ename) AS employees FROM emp GROUP BY deptno; Error:- ORA-00923: FROM keyword not found where expected 00923. 00000 - "FROM keyword not found where expected" *Cause: *Action: Error at Line: 1 Column: 42 Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production 回答1: In this article you have different approaches to dealing with string aggegation, including those to take into account if you are running an Oracle version

Get last insert id with Oracle 11g using JDBC

与世无争的帅哥 提交于 2019-12-04 07:05:50
I'm new to using Oracle so I'm going off what has already been previously answered in this SO question . I just can't seem to get it to work. Here's the statement that I'm using: declare lastId number; begin INSERT INTO "DB_OWNER"."FOO" (ID, DEPARTMENT, BUSINESS) VALUES (FOO_ID_SEQ.NEXTVAL, 'Database Management', 'Oracle') RETURNING ID INTO lastId; end; When I call executeQuery the PreparedStatement that I have made, it inserts everything into the database just fine. However, I cannot seem to figure out how to retrieve the ID. The returned ResultSet object will not work for me. Calling if

Return Date got no hour and minutes returned

五迷三道 提交于 2019-12-04 06:53:03
问题 This is my code CREATE OR REPLACE FUNCTION GET_DATE(P_DAYS IN NUMBER) RETURN DATE AS V_DATE DATE; BEGIN V_DATE := SYSDATE+P_DAYS; DBMS_OUTPUT.PUT_LINE(TO_CHAR(V_DATE, 'YYYY-MM-DD HH24:MI:SS')); RETURN V_DATE; END; / My output: GET_DATE(2) ----------- 2015-03-12 2015-03-12 19:26:14 How do i get minutes, hours and seconds returned ? i want the answer to be like the dbms_output does... 回答1: I think you need to do something like this: CREATE OR REPLACE FUNCTION GET_DATE(p_days IN NUMBER) RETURN

PLS-00306: wrong number or types of arguments in call to 'select_s'

耗尽温柔 提交于 2019-12-04 06:37:33
问题 Just calling this directly from the editor (Toad). No idea why getting the above error having checked the function definition and variable types repeatedly. All of the information available online seems to be for stored procedures - which I don't believe are used here DECLARE TYPE attrs_type is VARRAY(10) of STRING(10); l_ldap_host VARCHAR(255) := 'SERVERNAME'; l_ldap_port INT := 389; l_ldap_user VARCHAR(255) := 'USERNAME'; l_ldap_passwd VARCHAR(255) := 'PASSWORD'; l_ldap_base VARCHAR(255) :=