oracle11g

Oracle 11g - find out a new distinct value

回眸只為那壹抹淺笑 提交于 2020-01-07 01:22:52
问题 I've a table of users and one of the columns is User_ID ( naming policy = first letter of first name and rest is the last name. If a name is exists, then increment by 1). For example: John Doe -> user_id=jdoe If jdoe already exists then user_id = jdoe1 The input for the query is a basic user_id (e.g. jdoe) I would like to scan the table and for the output of the query to be : a new distinct value of user_id. If the table has the following values: jdoe jdoe1 jdoe2 jdoe3 The output should be

Oracle 11g - find out a new distinct value

心不动则不痛 提交于 2020-01-07 01:22:28
问题 I've a table of users and one of the columns is User_ID ( naming policy = first letter of first name and rest is the last name. If a name is exists, then increment by 1). For example: John Doe -> user_id=jdoe If jdoe already exists then user_id = jdoe1 The input for the query is a basic user_id (e.g. jdoe) I would like to scan the table and for the output of the query to be : a new distinct value of user_id. If the table has the following values: jdoe jdoe1 jdoe2 jdoe3 The output should be

How to Dense_Rank() Sets of Values that Repeat

六眼飞鱼酱① 提交于 2020-01-07 01:22:13
问题 I have a table T like the following: T Table EMPLID CODE DT 101 PPP 01-JAN-15 101 PPP 02-JAN-15 101 PPP 03-JAN-15 101 OOO 04-JAN-15 101 OOO 05-JAN-15 101 PPP 06-JAN-15 101 PPP 07-JAN-15 101 PPP 08-JAN-15 101 PPP 09-JAN-15 what I want is a result like the following: EMPLID CODE RNK DT 101 PPP 1 01-JAN-15 101 PPP 1 02-JAN-15 101 PPP 1 03-JAN-15 101 OOO 2 04-JAN-15 101 OOO 2 05-JAN-15 101 PPP 3 06-JAN-15 101 PPP 3 07-JAN-15 101 PPP 3 08-JAN-15 101 PPP 3 09-JAN-15 but I only seem to be getting

Why DBMS_XMLSCHEMA fails to validate a valid xs:dateTime?

不想你离开。 提交于 2020-01-06 21:05:03
问题 I'm going to validate and process XML provided by a third party. The XML conforms a standardized XML schema also provided by a third party. For validation I use DBMS_XMLSCHEMA essentially this way: -- pseudocode follows declare xmldoc xmltype; begin dbms_xmlschema.registerschema(schemaurl => name, schemadoc => xmltype(schema), local => true, gentypes => false, gentables => false ); xmldoc := xmltype(xml).createSchemaBasedXML(schema_name); xmldoc.schemavalidate; end; Validation seems to work

Hibernate OneToMany with Mismatched Composite Primary Keys

强颜欢笑 提交于 2020-01-06 18:09:22
问题 I have two tables in my database that are mapped together via composite primary key/foreign keys, and I'm having a hell of a time getting Hibernate to work with them. My database looks like this: TABLE1 has a composite primary key of foreign keys, mapping to TABLE_A and TABLE_B. TABLE2 also has a composite primary key of foreign keys, mapping to TABLE_A, TABLE_B, and TABLE_D. In the database, TABLE2 maps back to TABLE1 using just the first two foreign keys. No problems there. It's translating

Oracle Update query with join

雨燕双飞 提交于 2020-01-06 14:38:09
问题 There are tow tables. first one is expenses and second one is expenses_items . There are 2 columns in expenses table as expns_id and expns_job_type . There are 2 columns in expenses_items table as expns_id (foreign key from expenses table) and group . I need to update group in expenses_items table and set it's value as development where value of expns_job_type in expenses table like new building . I have tried below query. but not worked. update expenses_items set expenses_items."group" =

Soundex with numbers as String parameter

萝らか妹 提交于 2020-01-06 08:46:17
问题 Do you know some explanation why SOUNDEX does not work with NUMBERS as string? These queries works fine: select 1 from dual where soundex('for you') = soundex('for u') ; select 1 from dual where soundex('for you') = soundex('for you') ; But this one doesn´t: select 1 from dual where soundex('6000') = soundex('6000') ; select 1 from dual where soundex('5') = soundex('5') ; I was reading documentation http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions167.htm#SQLRF06109 but does not

generate xml file from oracle table

混江龙づ霸主 提交于 2020-01-06 08:32:53
问题 when I ran below store procedure then it shows error. here some special char related issue ,so i cant generate xml file , here xml format same as generate XML from oracle tables Connecting to the database DB_old. ORA-29285: file write error ORA-06512: at "SYS.UTL_FILE", line 148 ORA-06512: at "SYS.UTL_FILE", line 889 ORA-06512: at "DBO_17FEB.EXPOR1", line 60 ORA-06512: at line 6 Process exited. Disconnecting from the database DB_old. ------------------- create or replace PROCEDURE Expor1 ( V

generate xml file from oracle table

会有一股神秘感。 提交于 2020-01-06 08:30:33
问题 when I ran below store procedure then it shows error. here some special char related issue ,so i cant generate xml file , here xml format same as generate XML from oracle tables Connecting to the database DB_old. ORA-29285: file write error ORA-06512: at "SYS.UTL_FILE", line 148 ORA-06512: at "SYS.UTL_FILE", line 889 ORA-06512: at "DBO_17FEB.EXPOR1", line 60 ORA-06512: at line 6 Process exited. Disconnecting from the database DB_old. ------------------- create or replace PROCEDURE Expor1 ( V

Create trigger for auto incerment id and default unix datetime

爱⌒轻易说出口 提交于 2020-01-06 08:18:27
问题 Any one help me to create a trigger for auto increment fld_id and Unix datetime. My table field is fld_id(int),fld_date(number),fld_value(varchar2). My insert query is insert into table (fld_value)values('xxx'); insert into table (fld_value)values('yyy'); I need the table record like this fld_id fld_date fld_value 1 1354357476 xxx 2 1354357478 yyy Please help me to create this.I can't able to do this.. 回答1: If you want fld_id to be a sequential value, you'll need to create a sequence and a