oracle12c

How to install Oracle Instant Client on a Mac?

只谈情不闲聊 提交于 2019-12-02 18:18:44
How to install Oracle Instant Client Version 12.1.0.2 (64-bit) on a Mac (OS X 10.11.5) I have downloaded version 12.1.0.2 (64-bit) version and unzipped the file. I now have the following files under /downloads/instantclient: libclntsh.dylib.12.1 libclntshcore.dylib.12.1 libnnz12.dylib libocci.dylib.12.1 libociei.dylib libocijdbc12.dylib libons.dylib liboramysql12.dylib ojdbc6.jar ojdbc7.jar uidrvci xstreams.jar adrci BASIC_README genezi I don't have the slightest idea how to go from this to a working version of Instant Client so I can connect to a db from the CLI. The instructions on Oracles

INSERT ALL - For more than 1000 rows

醉酒当歌 提交于 2019-12-02 15:37:43
问题 I have an INSERT ALL query in my program like: <insert id="insertRecord" parameterType="java.util.List"> INSERT ALL <foreach collection="myList" item="addrElement" index="index"> INTO MYTABLE (COLUMN1,COLUMN2,COLUMN3) values (#{addrElement.element1},#{addrElement.element2},#{addrElement.element3}) </foreach> SELECT * FROM dual </insert> The list will hold a minimum of 10000 records. Obviously, this is throwing an exception since INSERT ALL cannot handle more than 1000 records. ; bad SQL

INSERT ALL - For more than 1000 rows

ぃ、小莉子 提交于 2019-12-02 11:44:48
I have an INSERT ALL query in my program like: <insert id="insertRecord" parameterType="java.util.List"> INSERT ALL <foreach collection="myList" item="addrElement" index="index"> INTO MYTABLE (COLUMN1,COLUMN2,COLUMN3) values (#{addrElement.element1},#{addrElement.element2},#{addrElement.element3}) </foreach> SELECT * FROM dual </insert> The list will hold a minimum of 10000 records. Obviously, this is throwing an exception since INSERT ALL cannot handle more than 1000 records. ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00913: too many values I have checked

Update duplicate rows only with a MAX function in SQL

↘锁芯ラ 提交于 2019-12-02 10:40:46
I have a table like this, where, suppose for the sake of an example, NAME is a unique identifier. NAME AGE VALUE Jack Under 65 3 Jack 66-74 5 John 66-74 7 John Over 75 9 Gill 25-35 11 Some NAME s have more than one AGE , which is undesirable, as this is due to dirtiness of the data. My aim is to update the duplicates only to have one AGE within each NAME . The desired output is thus: NAME AGE VALUE Jack Under 65 3 Jack Under 65 5 John 66-74 7 John 66-74 9 Gill 25-35 11 Something like this UPDATE statement should work, but it doesn't. UPDATE table t1 SET t1.age=MAX(t1.age) WHERE EXISTS (SELECT

Oracle Pagination strategy

自古美人都是妖i 提交于 2019-12-02 08:20:24
问题 I want to fetch million of rows from a table between two timestamps and then do processing over it. Firing a single query and retrieving all the records at once looks to be a bad strategy as it might exceed the memory capabilities of my JVM program. I have read this article: http://oracle.readthedocs.io/en/latest/sql/indexes/top-n-pagination.html Hence, I am planning to do pagination in batches of 1000 and have come up with following strategy: Let's say Start_Date = X and End_Date = Y Fire a

Difference between SYS.ALL_TAB_COLUMNS and SYS.ALL_TAB_COLS in Oracle 12c

淺唱寂寞╮ 提交于 2019-12-01 22:10:19
What is the difference between the ALL_TAB_COLUMNS and ALL_TAB_COLS system tables in Oracle 12c? In my DB, the ALL_TAB_COLUMNS has slightly fewer rows than ALL_TAB_COLS. From the Oracle manual for ALL_TAB_COLS This view differs from "ALL_TAB_COLUMNS" in that system-generated hidden columns and invisible columns, which are user-generated hidden columns, are not filtered out. From the Oracle manual for ALL_TAB_COLUMNS This view filters out system-generated hidden columns and invisible columns, which are user-generated hidden columns. The ALL_TAB_COLS view does not filter out hidden columns and

No usename HR in Oracle 12c

时光毁灭记忆、已成空白 提交于 2019-12-01 16:12:03
I have installed oracle 12c in my ubuntu. I use oracle through sqldeveloper and I can successfully connect to user sys with my password. I want to be able to use all databases provided by oracle by default. When I try to connect with username hr with the same password as in sys I get error username not found. select * from all_users doesn't list user hr . So I assume the user is not created at all. Should it not have been available by default, hr user? How can I configure such that I get the access to all `hr` databases? I have installed oracle 12c in my ubuntu. I assume the user is not

Convert decimal year to date

喜夏-厌秋 提交于 2019-12-01 12:24:18
I have dates in a table that are stored as decimal years . An example is 2003.024658 which translates to January 9, 2003 . I would like to convert the decimal years to Oracle's date format. I've found someone who's done this in Excel: Decimal year to date formula? =DATE(INT(B1),1,MOD(B1,1)*(DATE(INT(B1)+1,1,1)-DATE(INT(B1),1,1))) However, I can't quite figure out how to convert the logic to Oracle PL/SQL. If you start from the assumption that the decimal portion was calculated according to the number of days in the given year (i.e. 365 or 366 depending on whether it was a leap year), you could

Need to arrange employee names as per their city column wise

我只是一个虾纸丫 提交于 2019-12-01 11:43:36
问题 I have written a query which extracts the data from different columns group by city name. My query is as follows: select q.first_name from (select employee_id as eid,first_name,city from employees group by city,first_name,employee_id order by first_name)q , employees e where e.employee_id = q.eid; The output of the query is employee names in a single column grouped by their cities. Now I would like to enhance the above query to classify the employees by their city names in different columns.

Oracle : Export select statement result set as INSERT SQL Statements similar to SQL developer export

对着背影说爱祢 提交于 2019-12-01 06:53:23
I am looking for a solution to create the SQL INSERT statements using PL/SQL script for the select statement result set. Looking for similar feature available in the SQL Developer tool (export --> format insert) but I want the solution as script rather than using any tool(s). I have referred the below solution. However, I would like to know whether any better way to do it as the solution is old and not very simple. EXPORT AS INSERT STATEMENTS: But in SQL Plus the line overrides 2500 characters! I just found a simple solution for my problem using oracle hint ("insert"). This automatically take