oracle10g

LISTAGG alternative in Oracle 10g

浪子不回头ぞ 提交于 2019-12-19 09:10:12
问题 I am kind of newbie in Oracle. Got stuck in the below: I have the below 2 tables: Site: **SiteID|SiteName** 1 Sydney 2 Newyork 3 Delhi People: **RecordID|PeopleID|SiteID** 1 1 1 2 1 2 3 2 2 4 3 1 5 3 2 6 3 3 Now in my query I want an output something like this: **PeopleID | AssignedSites** 1 Sydney,NewYork 2 Newyork 3 Sydney,NewYork,Delhi Few more points: -The solution should work in Oracle 10g as well as 11g also. -I have given small subset of data in the above example for brevity.But, in my

SQL - Missing right parenthesis

不想你离开。 提交于 2019-12-19 08:58:48
问题 I am trying to execute this script in Oracle 11g and getting the following error, I dont know where I am missing the paranthesis or what is the mistake kindly help me figure this out. Script: CREATE TABLE User_Role ( user_role_id INT NOT NULL , Users_user_id INT FOREIGN KEY REFERENCES Users(user_id), User_Types_user_type VARCHAR(20) FOREIGN KEY REFERENCES User_Types(user_type), PRIMARY KEY(user_role_id) ) Error: ORA-00907: missing right parenthesi 回答1: Delete FOREIGN KEY clause. Rewrite your

How does order by clause works if two values are equal?

孤者浪人 提交于 2019-12-19 05:48:11
问题 This is my NEWSPAPER table. National News A 1 Sports D 1 Editorials A 12 Business E 1 Weather C 2 Television B 7 Births F 7 Classified F 8 Modern Life B 1 Comics C 4 Movies B 4 Bridge B 2 Obituaries F 6 Doctor Is In F 6 When i run this query select feature,section,page from NEWSPAPER where section = 'F' order by page; It gives this output Doctor Is In F 6 Obituaries F 6 Births F 7 Classified F 8 But in Kevin Loney's Oracle 10g Complete Reference the output is like this Obituaries F 6 Doctor

How does order by clause works if two values are equal?

心已入冬 提交于 2019-12-19 05:48:04
问题 This is my NEWSPAPER table. National News A 1 Sports D 1 Editorials A 12 Business E 1 Weather C 2 Television B 7 Births F 7 Classified F 8 Modern Life B 1 Comics C 4 Movies B 4 Bridge B 2 Obituaries F 6 Doctor Is In F 6 When i run this query select feature,section,page from NEWSPAPER where section = 'F' order by page; It gives this output Doctor Is In F 6 Obituaries F 6 Births F 7 Classified F 8 But in Kevin Loney's Oracle 10g Complete Reference the output is like this Obituaries F 6 Doctor

What is the maximum statement length in Oracle

跟風遠走 提交于 2019-12-19 05:46:36
问题 I'm building a SQL statement that contains data and I'm wondering if I would break some maximum statement length in Oracle 10g. The statement would be about 3 200 000 bytes, cannot be split and has to be parsable in its entirety. Before I'm investing too much time this way, I was wondering if I would be limited by the size of this statement. I am using SQL developer but I think that if the server can do it, so can SQL developer. 回答1: There is no fixed number. See "Logical Database Limits":

What is the difference between USER() and SYS_CONTEXT('USERENV','CURRENT_USER')?

南笙酒味 提交于 2019-12-19 05:13:14
问题 In an Oracle Database, what are the differences between the following: user() sys_context('USERENV', 'CURRENT_USER') sys_context('USERENV', 'SESSION_USER') Are these also possible related values to whatever 'the current user' is? sys_context('USERENV', 'CURRENT_SCHEMA') sys_context('USERENV', 'AUTHENTICATED_IDENTITY') I am specifically interested in which ones can change, what can change them, which ones can not change value, which ones have different values based on connection type, and

Capture values that trigger DUP_VAL_ON_INDEX

主宰稳场 提交于 2019-12-19 04:22:57
问题 Given this example (DUP_VAL_ON_INDEX Exception), is it possible to capture the values that violated the constraint so they may be logged? Would the approach be the same if there are multiple violations generated by a bulk insert? BEGIN -- want to capture '01' and '02' INSERT INTO Employee(ID) SELECT ID FROM ( SELECT '01' ID FROM DUAL UNION SELECT '02' ID FROM DUAL ); EXCEPTION WHEN DUP_VAL_ON_INDEX THEN -- log values here DBMS_OUTPUT.PUT_LINE('Duplicate value on an index'); END; 回答1: Ideally,

SQL Error: ORA-02298: cannot validate (SYSTEM.AEROPUERTO_FK) - parent keys not found

半腔热情 提交于 2019-12-18 18:56:42
问题 I'm getting the following error in on Oracle SQL Developer: Error starting at line 1 in command: ALTER TABLE AEROPUERTO ADD CONSTRAINT AEROPUERTO_FK FOREIGN KEY (CODIGO_CIUDAD) REFERENCES CIUDAD(CODIGO) Error report: SQL Error: ORA-02298: cannot validate (SYSTEM.AEROPUERTO_FK) - parent keys not found 02298. 00000 - "cannot validate (%s.%s) - parent keys not found" *Cause: an alter table validating constraint failed because the table has child records. *Action: Obvious Why? 回答1: There are

Oracle text search on multiple tables and joins

瘦欲@ 提交于 2019-12-18 18:04:45
问题 I have the following SQL statement. select emp_no,dob,dept_no from v_depts where catsearch (emp_no,'abc',NULL) > 0 or catsearch (dept_no,'abc',NULL) > 0 where v_depts is a view. Now I would like to add one or more tables as join so that I can do text search on columns e.g. employee_details contains employee information and I can join with emp_no I have created index on employee_details table for emp_name column, however I am not able to join with v_depts to search because I modify my sql

Error with NHibernate 2.1 and Oracle 10g client

梦想与她 提交于 2019-12-18 17:15:44
问题 I need to get NHibernate 2.1 to talk to an oracle database. I am being required to use the Oracle 10g client. I get the following error when trying to build my session factory: Unable to cast object of type 'Oracle.DataAccess.Client.OracleConnection' to type 'System.Data.Common.DbConnection'. I don't recall getting this error with NHibernate 2.01. I am trying to get the server admins to install the 11g client, but it looks like that is a loosing battle. Here are the important bits from my web