oracle11g

How to use ROLLUP, RANK() with pivot table in Oracle11g

你说的曾经没有我的故事 提交于 2019-12-22 23:14:44
问题 Table schema CREATE TABLE customer ( id NUMERIC, lname VARCHAR (30), fname VARCHAR (30) NOT NULL, street VARCHAR (30) NOT NULL, city VARCHAR (30) NOT NULL, zipcode NUMERIC (5) NOT NULL, state VARCHAR (2) NOT NULL, phone VARCHAR (12) NOT NULL, creditscore NUMERIC, credit_org VARCHAR (30), cs_date DATE, CONSTRAINT customer_pk PRIMARY KEY (id) ); Requirement: Part 1: Create a pivot table to list the number of customers by location ('PA', 'CA', 'NY', 'MD') and also by creditscore range. For

How to use ROLLUP, RANK() with pivot table in Oracle11g

一曲冷凌霜 提交于 2019-12-22 23:13:30
问题 Table schema CREATE TABLE customer ( id NUMERIC, lname VARCHAR (30), fname VARCHAR (30) NOT NULL, street VARCHAR (30) NOT NULL, city VARCHAR (30) NOT NULL, zipcode NUMERIC (5) NOT NULL, state VARCHAR (2) NOT NULL, phone VARCHAR (12) NOT NULL, creditscore NUMERIC, credit_org VARCHAR (30), cs_date DATE, CONSTRAINT customer_pk PRIMARY KEY (id) ); Requirement: Part 1: Create a pivot table to list the number of customers by location ('PA', 'CA', 'NY', 'MD') and also by creditscore range. For

VARCHAR max length is 4000 but only 2666 byte long Thai text can be stored

自作多情 提交于 2019-12-22 22:19:24
问题 I'm working with Oracle database 11g with PL/SQL. program is written in C#, .NET 4. I have a table with a varchar(4000) column, and I want to store in DB a text in Thai language. I found that when I try to store text in Thai that its length is longer than 1333 Oracle throws an exception, although the maximum length is 4000: ORA-01461: can bind a LONG value only for insert into a LONG column I also noticed that when I work with smaller limitation it works as expected. i.e.: varchar(10) -

Spring Batch DataSourceTransactionManager fails on Oracle

这一生的挚爱 提交于 2019-12-22 19:25:14
问题 I'm using WebLogic 10.3.3 with Oracle 11g and face a weird problem with Spring Batch as soon as I'm switching from Spring ResourcelessTransactionManager (which is mainly for testing) to the productive DataSourceTransactionManager. First I used WebLogics default driver oracle.jdbc.xa.client.OracleXADataSource but this one fails because Spring can't set the isolation level - this is also documented here. I'm fine with that since I don't need global transactions anyway so I switched to oracle

Oracle database search all tables for string, return row data [duplicate]

故事扮演 提交于 2019-12-22 18:54:20
问题 This question already has answers here : Search All Fields In All Tables For A Specific Value (Oracle) (15 answers) Closed 5 years ago . I need to search all tables in an oracle database for a specific string and return all the records where that string is found. I am working with SQL Developer. There are several really useful scripts and stored procedures that have been posted online that provide a way to search the entire database and they all seem to be able to return the table name and

How to import a Oracle 11g RMAN backupset on a new database server?

旧时模样 提交于 2019-12-22 17:39:54
问题 I have got a backupset of an Oracle 11g database which was created with RMAN. Now I want to import/restore the backupset onto a new and empty database server. I know that the command to create the backupset was run { backup as compressed backupset database tag "FULLBACKUP" format "/orabackup/rman/backup/FULL_%d_%T_%U"; backup as compressed backupset archivelog all tag "ARCHIVELOGS" format "/orabackup/rman/backup/ARCH_%d_%T_%U" delete all input; } but I cannot find out how to make the files

Does storing date without time use less bytes?

随声附和 提交于 2019-12-22 16:30:32
问题 I saw this link and this: If you specify a date value without a time component, then the default time is midnight. If you specify a date value without a date, then the default date is the first day of the current month. Oracle DATE columns always contain fields for both date and time. If your queries use a date format without a time portion, then you must ensure that the time fields in the DATE column are set to midnight. The solution is to put a constraint on column with the date data-type

Oracle Conditional where clause

↘锁芯ラ 提交于 2019-12-22 11:23:00
问题 is there any way to write query with following functionality, add where clause as a conditional way, select e.emp_id, emp.admin_user from employees e if emp.admin != 'Y' then query run with where clause else query run without where clause ? 回答1: Using a CASE expression in the WHERE clause should do the trick. When you say you don't need the where clause if condition is not met, then all you want is a condition like WHERE 1 = 1 , i.e. when condition is not met then return all rows. So, you

Search for similar words using an index

落花浮王杯 提交于 2019-12-22 11:11:48
问题 I need to search over a DB table using some kind of fuzzy search like the one from oracle and using indexes since I do not want a table scan(there is a lot of data). I want to ignore case, language special stuff(ñ, ß, ...) and special characters like _, (), -, etc... Search for "maria (cool)" should get "maria- COOL" and "María_Cool" as matches. Is that possible in Oracle in some way? About the case, I think it can be solved created the index directly in lower case and searching always lower

UPDATE statement: re-evaluate subquery after each SET

﹥>﹥吖頭↗ 提交于 2019-12-22 09:24:24
问题 CREATE TABLE test (id NUMBER(3)); INSERT INTO test VALUES (1); INSERT INTO test VALUES (2); INSERT INTO test VALUES (2); INSERT INTO test VALUES (3); INSERT INTO test VALUES (4); INSERT INTO test VALUES (4); INSERT INTO test VALUES (5); I want to make the numbers in test unique (like {1,2,3,4,5,6,7} - i.e. remove doubles) using this query: UPDATE test u SET u.id = (SELECT max(nn.id) FROM test nn) + 1 WHERE 1 < ( SELECT tt.rown FROM (SELECT rowid, row_number() over ( partition by t.id order by