oracle11g

Oracle 11g ado connection strings for ODBC (not OLEDB) using excel VBA 64 bit (DSN Less and tnsnames)

帅比萌擦擦* 提交于 2019-12-10 19:22:17
问题 Please help. I have researched this for hours. I get some parts to work but not others. What I am trying to do is write all the connection strings in excel VBA to connect to Oracle 11g database. I don't want to set up the User DSN in ODBC Administrator and I don't want to have to maintain a tnsnames.ora file. I can get this to work for OLEDB connection strings but I believe this is no longer supported by Oracle so I want to use the Oracle ODBC Driver commands only. This is what I have got to

Invalid column index , update using PreparedStatement

为君一笑 提交于 2019-12-10 19:22:09
问题 I am updating table using PreparedStatement the following code works perfectly pst = conn.prepareStatement("UPDATE playjdbc SET jlname ='javafx10new' WHERE jfname = 'java10'"); int i = pst.executeUpdate(); but when i tried like this it throwing exception pst = conn.prepareStatement("UPDATE playjdbc SET jlname ='javafx10new' WHERE jfname =?"); pst.setString(2, "java10"); // yeah second column is jfname int i = pst.executeUpdate(); stacktrace : java.sql.SQLException: Invalid column index at

Creating Package sqlplus

懵懂的女人 提交于 2019-12-10 19:19:56
问题 I am trying to create a package from the following procedure CREATE OR REPLACE PROCEDURE insert_rows (pl_deptno dept.deptno%TYPE, pl_dname dept.dname%TYPE, pl_loc dept.loc%TYPE ) AS BEGIN INSERT INTO dept (deptno,dname,loc) values ( pl_deptno,pl_dname,pl_loc); commit; end insert_rows; / So far this is my package sec which, creates fine create or replace package fpf is procedure insert_rows (p_deptno IN dept.deptno%TYPE, p_dname IN dept.dname%TYPE, p_loc IN dept.loc%TYPE); end fpf; / But, when

last time a table was accessed in oracle

本小妞迷上赌 提交于 2019-12-10 19:17:24
问题 Is it possible to determine when the last time a table was accessed in Oracle? I am trying this, but this will not include when was the last time the table was selected. select * from dba_objects; 回答1: select p.object_owner owners, p.object_name Obj_Name, p.operation Operation, p.options Options, count(1) Idx_Usg_Cnt from dba_hist_sql_plan p,dba_hist_sqlstat s where p.object_owner = '&USERNAME' and p.operation like 'TABLE%' and p.sql_id = s.sql_id and p.object_name=’&OBJNAME’ group by p

create id column based on activity data

一世执手 提交于 2019-12-10 19:06:46
问题 I have a table EVENTS USER EVENT_TS EVENT_TYPE abc 2016-01-01 08:00:00 Login abc 2016-01-01 08:25:00 Stuff abc 2016-01-01 10:00:00 Stuff abc 2016-01-01 14:00:00 Login xyz 2015-12-31 18:00:00 Login xyz 2016-01-01 08:00:00 Logout What I need to do is produce a session field for each period of activity for each user. In addition, if the user has been idle for a period equal to or longer than p_timeout (1 hour in this case) then a new session starts at the next activity. Users don't always log

Single quote in dbms_output statement?

馋奶兔 提交于 2019-12-10 19:06:04
问题 I need to include single quotes in dbms_output statement. I've tried this: dbms_output.put_line('\''first_name||'\''); Here first_name is variable ; I need to display this inside single quotes. 回答1: you'd escape by doubling up: dbms_output.put_line('''' || first_name || ''''); or using the q-quote mechanism: dbms_output.put_line(q'[']'||first_name||q'[']'); eg: SQL> var b1 varchar2(30) SQL> exec :b1 := 'this is a test'; PL/SQL procedure successfully completed. SQL> exec dbms_output.put_line(q

Oracle 11g - FOR loop that inserts only weekdays into a table?

浪尽此生 提交于 2019-12-10 17:48:39
问题 I want to insert some data into a table associated with dates for the next year. I actually only need workdays inserted. BEGIN FOR i IN 1..365 LOOP INSERT INTO MY_TABLE (ID, MY_DATE) VALUES (i, (to_date(sysdate,'DD-MON-YY')-1)+i); END LOOP; END; I can solve my problem by going back and deleting rows that are weekend days, but that seems rather inelegant - can anyone think of a way to modify my loop so that it skips weekends? 回答1: You could always check the day of the week before inserting the

Oracle 11 - sqlplus - rollback the whole script on error - how?

喜你入骨 提交于 2019-12-10 17:16:22
问题 How can I make Oracle 11g rollback the whole transaction on any error in included SQL file? The file contents are: set autocommit off whenever SQLERROR EXIT ROLLBACK insert into a values (1); insert into a values (2); drop index PK_NOT_EXIST; commit; And the file is included into sqlplus session using "@": @error.sql As expected, the sqlplus session terminates and the output is SQL> @error.sql 1 row created. 1 row created. drop index PK_NOT_EXIST * ERROR at line 1: ORA-01418: specified index

MAX() in ORACLE SQL

依然范特西╮ 提交于 2019-12-10 17:08:32
问题 I have a table that stores a list of records for Maintenance tasks that have been done and the date and time that they were done. I'm trying to do a sub-query to pull out the records for each task that has the most recent date. My SQL statement is: SELECT "ENGINEERING_COMPLIANCE"."EO" AS "EO", "ENGINEERING_COMPLIANCE"."AC" AS "AC", "ENGINEERING_COMPLIANCE"."PN" AS "PN", "ENGINEERING_COMPLIANCE"."PN_SN" AS "PN_SN", "ENGINEERING_COMPLIANCE"."HOURS_RESET" AS "HOURS_RESET", "ENGINEERING

How to use one schema by multiple users without pre-fixing schema name before the objects?

浪尽此生 提交于 2019-12-10 16:38:47
问题 I have searched for many posts to achieve the below problem. But could not get the solution. Can some one resolve this please. Problem. I have created a user/Schema with name RAMFULL with connect,resource privileges granted. and I want to access this user with oracle user called RAMREAD as alias having read only privilege. I need not mention the Adminitrator/full privilege user RAMFULL to others during the accessing/using the objects in RAMFULL. I have created a user/Schema with name RAMFULL