oracle9i

VBA/ADODB Run-Time Error: 3704

你说的曾经没有我的故事 提交于 2019-12-25 02:52:21
问题 The following VBA subroutine will run most queries just fine. (ie: SELECT * FROM DUAL ) Sub DisplayQuery(QueryString As String) Dim rs As New ADODB.Recordset Dim connStr As String connStr = _ "Provider=MSDAORA.1;" _ & "User ID=abc;Password=123;" _ & "Data Source=xxx/xxx;" out QueryString rs.Open QueryString, connStr, adOpenStatic, adLockOptimistic Range("DataTable").Clear Cells(1, 1).CopyFromRecordset rs End Sub However, when I run the query below, the following error message immediately pops

Overcoming the restriction on bulk inserts over a database link

房东的猫 提交于 2019-12-24 00:53:38
问题 It appears as though there's an implementation restriction that forbids the use of forall .. insert on Oracle, when used over a database link. This is a simple example to demonstrate: connect schema/password@db1 create table tmp_ben_test ( a number , b number , c date , constraint pk_tmp_ben_test primary key (a, b) ); Table created. connect schema/password@db2 Connected. declare type r_test is record ( a number, b number, c date); type t__test is table of r_test index by binary_integer; t

Oracle ODBC : Driver's SQLAllocHandle on SQL_HANDLE_ENV failed

天大地大妈咪最大 提交于 2019-12-19 11:22:37
问题 I have message Oracle ODBC : Driver's SQLAllocHandle on SQL_HANDLE_ENV failed when try to open oracle connection in excel. I'm working in virtual machine via citrix. Could you please give tips why it is appear and how avoid problem ? 回答1: The problem appears to be a permission issue during the installation of both Oracle 9i and 10G. If you navigate Oracle home you will find that the directory has different permissions then the root of the tree. In the case of 10G the path is C:Oracleproduct10

Create a Sequence with START WITH from Query

坚强是说给别人听的谎言 提交于 2019-12-17 19:37:42
问题 How can I create a Sequence where my START WITH value comes from a query? I'm trying this way: CREATE SEQUENCE "Seq" INCREMENT BY 1 START WITH (SELECT MAX("ID") FROM "Table"); But, I get the ORA-01722 error 回答1: The START WITH CLAUSE accepts an integer. You can form the "Create sequence " statement dynamically and then execute it using execute immediate to achieve this. declare l_new_seq INTEGER; begin select max(id) + 1 into l_new_seq from test_table; execute immediate 'Create sequence test

ORA-00942: table or view does not exist (works when a separate sql, but does not work inside a oracle function)

杀马特。学长 韩版系。学妹 提交于 2019-12-17 16:30:23
问题 When I have a sql statement like select * from table1 , it works great, but as soon as I put it into a function, I get: ORA-00942: table or view does not exist How to solve this? 回答1: There are a couple of things you could look at. Based on your question, it looks like the function owner is different from the table owner. 1) Grants via a role : In order to create stored procedures and functions on another user's objects, you need direct access to the objects (instead of access through a role)

Group rows Keeping the Order of values

五迷三道 提交于 2019-12-13 21:19:53
问题 How can I group following set of data: DATENO COL1 COL2 1 A 1 2 B 1 3 C 1 4 C 1 5 D 1 6 C 1 7 D 1 8 D 1 9 E 1 To get something like this: DATENO COL1 COL2 1 A 1 2 B 1 3 C 2 5 D 1 6 C 1 7 D 2 9 E 1 Sum for C and D are grouped keeping the order intact. Any ideas? 回答1: Updated: answer corrected according to comments. Rows can be grouped as required on such a way: -- leave only first rows of each group and substitute col2 with a sum. select dateno, col1, group_sum as col2 from ( -- Get sum of

Problem with joining db tables

妖精的绣舞 提交于 2019-12-13 20:46:42
问题 I have problem when joining tables (left join) table1: id1 amt1 1 100 2 200 3 300 table2: id2 amt2 1 150 2 250 2 350 my Query: select id1,amt1,id2,amt2 from table1 left join table2 on table2.id1=table1.id2 My supposed o/p is: id1 amt1 id2 amt2 row1: 1 100 1 150 row2: 2 200 2 250 row3: 2 200 2 350 I want o/p in row3 as 2 null 2 350 ie I want avoid repetition of data(amt1). 回答1: This really is a formatting issue which is best handled by the client . For instance, in SQL*Plus we can use BREAK ..

In oracle SQL, how would you obtain the timestamp representing the start of the week?

跟風遠走 提交于 2019-12-13 06:27:24
问题 I'm using an Oracle 9i database and want to obtain, within a function, the timestamp representing the start of the week, i.e. The most recent monday, at 00:00:00. I am aware that the timestamp representing the start of the current day is TO_TIMESTAMP(SYSDATE) . 回答1: You can use the function next_day to get that: SQL> select next_day(sysdate-7, 'MONDAY') FROM DUAL; NEXT_DAY --------- 29-APR-13 回答2: Getting the start of the week should work with trunc (see docs). So, select to_timestamp(trunc

ORA-12560: TNS:protocol adaptor error

◇◆丶佛笑我妖孽 提交于 2019-12-13 04:36:31
问题 I Google[d] for this error ORA-12560: TNS:protocol adaptor error but not able to find the actual reason and how to solve this error ? Can anyone tell me a perfect solution to solve login problem. 回答1: Go to the windows machine that hosts the Oracle database server Go to Start -> Run -> Services.msc in Windows. Locate OracleService < SID > (here OracleServiceORCL ) and click on Start to start the oracle database service (if not already running) Once it is up and running, from the command

ORA-22813: operand value exceeds system limits

假装没事ソ 提交于 2019-12-12 09:58:42
问题 I'm having an issue with an oracle object I created. The goal of the stored procedure is to either retreive all wires contained on an airplane or compare the list of wires with another one (past airplane wire configuration). You will understand that this can be quite big... I did a first shot with a table of objects. I make a select statement and loop through a cursor to insert values in my objects. The problem comes from when I try this: OPEN P_CURSOR FOR SELECT * FROM TABLE(CAST(GET_WIRES(P