oracle11g

Select unlocked rows oracle

不问归期 提交于 2019-12-08 13:22:36
问题 I have an application in C# that uses an Oracle database. I need a query to fetch the unlocked row from a table in oracle database. How can I select all unlocked rows? Is there any 'translator' out there that can translate this T-SQL (MS SQL Server) query to Oracle dialect? SELECT TOP 1 * FROM TableXY WITH(UPDLOCK, READPAST); I'm a little bit disappointed with Oracle lacking such a feature. They want to make me use AQ or what? 回答1: Oracle does have this feature, specifically the SKIP LOCKED

How do I select a row based on a priority value in another row?

ε祈祈猫儿з 提交于 2019-12-08 13:22:33
问题 I am using Oracle 11G and I have a table with the following columns and values and I want to select the value for each column based on the priority column. I only want one row for each ID. ID NAME NAME_PRIORITY COLOR COLOR_PRIORITY 1 SAM 2 RED 1 1 SAM 2 GREEN 2 1 JOHN 1 BLUE 3 2 MARY 2 ORANGE 1 3 JON 2 RED 2 3 PETE 3 GREEN 1 Desired Results ID NAME NAME_PRIORITY COLOR COLOR_PRIORITY 1 JOHN 1 RED 1 2 MARY 2 ORANGE 1 3 JON 2 GREEN 1 How do I select the NAME and COLOR with the lowest PRIORITY #

split blob file

只愿长相守 提交于 2019-12-08 13:21:06
问题 I need to retrieve from the database a few large wave files and would like to retrieve divided into wave files smaller (about 5Mb). How can I do? I've seen the procedure dbms_lob.read, but this return maximum file size of 32Kb. Regards procedure extract_blob(p_id in number, wrote_length in out number, chunk out blob) is len_file binary_integer; myblob blob; myname varchar2(255); buffer_length number := 32760; begin select file_wav_data, file_wav_name, dbms_lob.getlength(file_wav_data) into

How to obtain total children count for all parents in Oracle tree hierarchy?

南楼画角 提交于 2019-12-08 13:13:03
问题 I have an Oracle Tree hierarchy structure that is basically similar to the following table called MY_TABLE (LINK_ID, PARENT_LINK_ID, STEP_ID ) with the following sample data within MY_TABLE: LINK_ID PARENT_LINK_ID STEP_ID ----------------------------------------------- A NULL 0 B NULL 0 AA A 1 AB A 1 AAA AA 2 BB B 1 BBB BB 2 BBBA BBB 3 BBBB BBB 3 Based on the above sample data, I need to produce a report that basically returns the total count of rows for all children of both parent link IDs

ORA-12170 TNS listener in oracle 11g

☆樱花仙子☆ 提交于 2019-12-08 12:56:06
问题 I have setup a Windows Server 2008R2 with an oracle server 11g (11.2) and a small database (MYDB) in amazon EC2. Now I want to connect from my computer to this database (I use PL/SQL developer but I don't mind using other tools) In server side I have: (where ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com is the public DNS for my Win server.) tnsnames.ora: MYDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com)(PORT = 1521)) (CONNECT_DATA

Oracle “order by” clause returning results in wrong order or with results missing

纵然是瞬间 提交于 2019-12-08 12:42:12
问题 In my application logs, I can see that the query results are being iterated over (using a JDBC ResultSet, nothing fancy), and certain results which are actually in the table, are either missing, or appear too late in the resultset (I'm not sure which, because I often get a primary key violation before I hit the end if this happens). My query is: select t.* from myschema.vm t order by id; However I can't see this issue occurring when I run the exact same query in SQL Developer (while the

Converting DDMMYY to DDMMYYYY if born 00-49

核能气质少年 提交于 2019-12-08 12:39:07
问题 Norwegian social security numbers (SSN) is composed like this substr(ssn,1,6) = ddmmyy substr(ssn,7,3) = Person individual numbers: 000–499 persons born 1900–1999. 500–749 persons born 1854–1899. 500–999 persons born 2000–2039. 900–999 persons born 1940–1999. substr(ssn,11,2)=control digits I am struggling to convert date of birth to date format DD.MM.YYYY for persons born between 1900 and 1949 select to_date('121049','dd.mm.rrrr') from dual; -- Returns: 12.10.2049 select to_date('121049','dd

How to pair low/high cardinality columns as composite indexes?

风格不统一 提交于 2019-12-08 12:23:20
问题 This question concerns to Oracle DB, so if there are general answers I would like to know. As I am discarding information from Derby/MySQL and other DBs regarding this subject. Let's say I have several queries using the following columns on its WHERE clause: Column | Cardinality | Selectivity _______|__________________________ A | low | low B | high | low C | low | low D | high | high E | low | low F | low | low -- Queries SELECT * FROM T WHERE A:=? AND B:=? SELECT * FROM T WHERE A:=? AND B:=

Help building a SQL query from multiple tables

不羁的心 提交于 2019-12-08 12:02:19
问题 Given the following tables, how might I build a SQL query that includes a list of all the items from the "items" table, and a column for each color from the "colors" table that, for each item listed, indicates what colors the item has a relationship with. If that is unclear at all, please let me know what additional information will help clarify. The table information and desired SQL result are below: items table: id | item_name 1 | 'item 1' 2 | 'item 2' 3 | 'item 3' colors table: id | color

having three different triggers for the same table when need an unique id for insert

旧巷老猫 提交于 2019-12-08 11:52:21
问题 I have a table POI for Points of Interest with 3 triggers. One get geografic information. State, City, Street based on X,Y. Second do some validation on the field content and raise error if any violation. Third create audit record about what change and who make the change. This table used to be handle using mapinfo so before been inserted they have a unique generated id created for mapinfo. Now we are moving to QGIS and this program doesnt have an unique id. By my understanding oracle before