oracle10g

How can I configure my Oracle tnsnames file location? [closed]

南笙酒味 提交于 2019-12-04 16:27:04
I have Oracle 10g installed on Windows. Currently, my tnsnames file is stored at %ORACLEHOME%\network\admin. However, I want to configure Oracle to look somewhere else for that file. How can I do this? Andrew L You can use the TNS_ADMIN environment variable to specify a custom location of TNSNAMES.ORA file. Check this wiki: http://www.orafaq.com/wiki/TNS_ADMIN 来源: https://stackoverflow.com/questions/5568342/how-can-i-configure-my-oracle-tnsnames-file-location

Return Message of Error code in Oracle Stored Proc

流过昼夜 提交于 2019-12-04 14:22:43
The below procedure (in Oracle 11g release 1) accepts a sql as a parameter & returns its return code. Returns 0 if success Returns 1 if no update or no delete performs Returns actual error code in case of failure. How can I change below procedure to return me another out param say "return_message" which will contain short description of oracle internal error message? In case of success, it should say "success" and in case no delete/updates performed, it should say "nochange" CREATE OR REPLACE PROCEDURE "demo"."run_demo"(v_sql IN VARCHAR2, return_code OUT number) AS i number; BEGIN return_code

saving a polygon in oracle database

折月煮酒 提交于 2019-12-04 14:17:41
I have captured four points(coordinate) of a plot using a gps device. Point 1:- lat- 27.54798833 long- 80.16397166 Point 2:- lat 27.547766, long- 80.16450166 point 3:- lat 27.548131, long- 80.164701 point 4:- --- now I want to save these coordinate in oracle database which save it as an polygon. Thanks If you're intending to use Oracle Spatial for storage or processing of polygons, then you'll need to store the data as an SDO_GEOMETRY object. Here's a quick example: CREATE TABLE my_polygons ( id INTEGER , polygon sdo_geometry ) / INSERT INTO my_polygons ( id , polygon ) VALUES ( 1 , sdo

pl/sql - can collection loop through column names?

倖福魔咒の 提交于 2019-12-04 14:13:35
The output from the below code is: |LAT|MISC|SID|NO MIN_LENGTH|1|2|1|1 MAX_LENGTH|6|6|4|2 The output is as I expect, but is there anyway to loop through the columns using an index (ie. j) instead of doing RESULTS(I). MAX_LENGTH , RESULTS(I). MAX_LENGTH etc ? The concern is that when adding extra columns to the 'R_RESULT_REC' record, another loop is required. set serveroutput on DECLARE TYPE R_RESULT_REC IS RECORD (COL_NAME VARCHAR2(100), MIN_LENGTH NUMBER, MAX_LENGTH NUMBER ); TYPE tr_RESULT IS TABLE OF R_RESULT_REC; RESULTS TR_RESULT := TR_RESULT(); v_counter NUMBER := 1; BEGIN FOR J IN

Calling an Oracle stored procedure in C# using “Oracle.DataAccess” (with a parameter)

纵然是瞬间 提交于 2019-12-04 12:43:05
So I'm trying to call an Oracle stored procedure from my C# .NET application. Most online references I can find suggest "using System.Data.OracleClient;", but .Net 3.5 doesn't recognize that namespace so I'm using "Oracle.DataAccess.Client" instead. Here's some paraphrasing of my code below, with a previously setup and tested OracleConnection called 'myConn' already filled with parameter ':arg_myArg' (it's a number, if that matters): command.Connection = myConn; command.CommandType = CommandType.StoredProcedure; command.CommandText = "exec mySchema.myProc(:arg_myArg)" command.ExecuteNonQuery()

Oracle 10g Connect By Prior - Performance Issues

橙三吉。 提交于 2019-12-04 12:12:10
I have the following SQL statement: SELECT CONNECT_BY_ROOT ANIMAL_ID "ORIGINAL_ANIMAL" , ANIMAL_ID, LINE_ID, SIRE_ANIMAL_ID, DAM_ANIMAL_ID, LEVEL -1 "LEVEL" FROM ANIMALS START WITH ANIMAL_ID IN( '2360000002558' ) CONNECT BY ((PRIOR SIRE_ANIMAL_ID = ANIMAL_ID and LEVEL < 5) OR (PRIOR DAM_ANIMAL_ID = ANIMAL_ID AND LEVEL < 5)) This in in a table with about 1.6 Million animals. Each record has Animal_Id, Sire_Animal_Id, and Dam_Animal_Id (Sire = Father, Dam = Mother). I use this sql to display the full animal pedigree. Results Will show Animal, 2 Parent, 4 GrandParents, etc. My issue is that this

PL/SQL - Optional conditions in where-clause - without dynamic sql?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 11:24:59
问题 I have a query where not all conditions are necessary. Here's an example of what it looks like when all conditions are used: select num from (select distinct q.num from cqqv q where q.bcode = '1234567' --this is variable and q.lb = 'AXCT' --this is variable and q.type = 'privt' --this is variable and q.edate > sysdate - 30 --this is variable order by dbms_random.value()) subq where rownum <= 10; --this is variable The parts marked as --this is variable are the parts that, well, vary! If a

Difference Between Drop And Drop Purge In Oracle

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 10:22:38
问题 I am using Oracle Database and I am a bit confused about Drop and Purge Commands. In fact for me both does the same thing. Removes the table with schema from database. What is the main difference between these two? Drop Table Tablename; Drop Table Tablename Purge; 回答1: Normally, a table is moved into the recycle bin (as of Oracle 10g), if it is dropped. However, if the purge modifier is specified as well, the table is unrecoverably (entirely) dropped from the database. 回答2: Oracle Database

Update Oracle table column with row number

两盒软妹~` 提交于 2019-12-04 08:56:08
I want to update a table column with row number. Each row in empid column should update with related row number. I tried following query. UPDATE employee SET empid = row_number(); But this is not working. Any idea? First, this is not the correct syntax for the row_number() function, since you're missing the over clause (resulting in an ORA-30484 error). Even if it was, this would not work, as you cannot directly use window functions in a set clause (resulting in an ORA-30483 error). For this usecase, however, you could just use the rownum pseudo-column: UPDATE employee SET empid = ROWNUM;

What is the difference between INSTR and LIKE in Oracle?

走远了吗. 提交于 2019-12-04 08:55:20
Can some one tell me the difference between INSTR and LIKE in Oracle? Which one is faster in Oracle10g? That depends on the data and on the pattern. If you use like 'a%' , then Oracle can use a BTree indexes to look up the matches because it can search the btree with the start of the pattern and then consider only the subtree. This doesn't work for LIKE '%a' but you can work around this by creating a calculated column which reverses all values from the column you want to search (so you get the pattern above). If you use hashed indexes, there is little that Oracle can do but scan the whole