oracle11g

Union data from cursors into one

半世苍凉 提交于 2019-12-09 12:54:32
问题 I have stored procedure which executes another stored procedure several times. I need union and return data, which I have after executing second procedure. Can I in some way union data from several cursors into one another cursor? It is possible without temporary tables or table-like datatype? EDIT: Cursor count for union actually is n (where n is 1, 2, 3, etc, detecting by another procedure). For example: CREATE OR REPLACE PROCEDURE proc_data ( data_out OUT SYS_REFCURSOR ) IS BEGIN OPEN data

How do i create postgres to oracle dblink?

馋奶兔 提交于 2019-12-09 12:20:09
问题 How do I create dblink in postgres 9.2 ? I want to be able to use it using @ link in oracle? I am using postgres 9.2 64bit. DBlink is from postgres 9.2 to Oracle 11g. 回答1: If you need to access postgresql FROM Oracle: http://dbaspot.wordpress.com/2013/05/29/how-to-access-postgresql-from-oracle-database/ If you need to access Oracle FROM postgresql: http://pgxn.org/dist/oracle_fdw/ 来源: https://stackoverflow.com/questions/18998225/how-do-i-create-postgres-to-oracle-dblink

Oracle SQL Developer 3.1.07 extra spaces between characters using listagg

↘锁芯ラ 提交于 2019-12-09 09:21:31
问题 I am using SQL Developer 3.1.07 on an 11g database When I use listagg to extract multiple values from a field I get a space between each character in the results for the listagg column. The query returns all the values I expect to see, it's just the extra spaces that are driving me nuts. Any thoughts? Here is one query that I have used, but it happens everytime I use listagg in a query: select a.personnum Emp_ID , a.personfullname Name , a.companyhiredtm Hire_Date , a.employmentstatus Status

Grant alter on only one column in table

心不动则不痛 提交于 2019-12-09 08:21:48
问题 I want to grant a user only to edit one column in my table. What command do I use here? I use the oracle 11g database. I alrdy know how I can grant only read or delete on the whole table but how do I do it for only one column or more? pls give an example. 回答1: For example, you want to grant update privilege on ename column only, then give the following statement (where xyz is the username) grant update (ename) on emp to xyz; Syntax: grant update(column-name) on table-name to user-name EDIT:

Allen's Interval Algebra operations in SQL

混江龙づ霸主 提交于 2019-12-09 04:19:43
问题 I've been struggling to solve a few tricky problems in SQL where I need to infer asset utilisation from event intervals, and have just learned about Allen's Interval Algebra, which seems to be the key to solving these problems. The algebra describes 13 kinds of relationships between intervals, and the image below shows the first seven, with the rest being the inverse (i.e. y before x, y meets x, etc) But I'm having trouble finding out how to implement the relevant operations. Given my sample

How to go about a column with different values in a same row in sql?

醉酒当歌 提交于 2019-12-09 04:03:30
问题 my table has the following strucuture empno empname loan ref amount 1 abc 123 100 1 abc 456 200. i.e an employee can avail two loans(say car and scooter). The output expected: empno empname loan ref1 amt loanref2 amt 1 abc 120 100 456 200 to avoid duplicate empno repeating. How to go about it in sql??? 回答1: Concerning the previous comments on table design - there is, in fact, a redundancy in the table; you could store the empname in another table, which you would join with your table here to

In Oracle “AS” alias not working

和自甴很熟 提交于 2019-12-09 03:56:37
问题 Just want to know why Oracle not allowed "AS" alias in Query. In My project all queries which i returned have alias keyword "AS". For.eg; Select t1.id,t2.name from Table1 As t1 ,Table2 t2 on t1.id =t2.id above Query run in all Server like PostgreSQL ,Microsoft SQL server but in Oracle its Not working showing error "Command does not exists" because of alias "As". If i remove then it will run. just want to know why Oracle Server behave like this ? i want to run query using "AS"alias name. 回答1:

Is Oracle's EXTRACT function breaking the NOENTITYESCAPING in the XMLELEMENT?

女生的网名这么多〃 提交于 2019-12-09 03:16:27
问题 Oracle 11g. I figured out that if I add NOENTITYESCAPING to the XMLELEMENT function, it nicely turns off entity escaping. However, when I then pass the result to EXTRACT the escaping seems to come back again. select xmlelement(NOENTITYESCAPING e,id,'->') from (select level as id from dual connect by level < 6) XMLELEMENT(NOENTITYESCAPINGE,ID,'->') --------------------------------------- <E>1-></E> <E>2-></E> <E>3-></E> <E>4-></E> <E>5-></E> Now, adding EXTRACT : select xmlelement

How to schedule Oracle DBMS Jobs in a window

孤者浪人 提交于 2019-12-09 01:14:18
问题 I want to create an Oracle DBMS Job that runs every week day (not on weekends) from 09:00 to 20:00 every 10 min. I wonder if I can do that in the FREQ parameter of the job definition or I have to create a New Maintenance Window . It seems that with the solution proposed, the job runs at 9 and 20 only, and after first execution, when I run this query select owner, job_name, next_run_date from dba_scheduler_jobs where JOB_NAME = 'GET_INVOICES_JOB'; I got 09/10/17 20:01:27,000000000 EUROPE

How to use Oracle global temporary table?

吃可爱长大的小学妹 提交于 2019-12-09 00:44:02
问题 I am attempting to use an Oracle global temporary table without physically creating a table in the database. The following code is not working. Can someone please explain the proper way to use global temporary tables? declare global temporary table my_temp_table(column1 number) on commit preserve rows; begin insert into my_temp_table (column1) values (1); select * from my_temp_table; end; 回答1: Try the below using execute immediate: it uses exception handler to bypass if table already exists;