oracle11g

Union causing an ORA-01790: expression must have same datatype as corresponding expression

房东的猫 提交于 2019-12-08 07:45:18
问题 With the following query as an example: select p.product_id, p.product_name, product_type as product_type, from products group by p.product_id, p.product_name union select p.product_id, p.product_name, cast(collect(coalesce(product_type, decode(product_description,null,'DESCR' || '-' product_description) as my_type) as product_type, from products group by p.product_id, p.product_name The select statement in the first query returns product_type as a varchar and on the second query product_type

Unable to find procedure in DBA_PROCEDURES view

删除回忆录丶 提交于 2019-12-08 07:14:51
问题 I have created a procedure : create or replace procedure gg as begin insert into book values ('prashant','prashant','prashant'); commit; end; / Procedure has been created successfully.Now i want to check the package name for the corresponding procedure but i am not able to do so. I am using the below query : > SELECT * FROM SYS.DBA_PROCEDURES WHERE procedure_name ='gg'; Its giving 0 rows selected.Please help. 回答1: NOTE Please look at the UPDATE section for correct answer. The procedure name

Oracle NLS_DATE_FORMAT not working properly

拟墨画扇 提交于 2019-12-08 07:08:36
问题 In my application I am setting the NLS_DATE_FORMAT of the session to format all dates returned by the program using the following command: alter session set nls_date_format='DY DDTH MON YYYY'; This should return the date like this: 'Fri 23rd Aug 2013' However, if I run the following query: select SYSDATE from dual; I get the date in the following format: 'FRI 23 AUG 2013'. Notice the lack of the 'rd' after '23'. If I run the following query: select to_char(sysdate, 'DY DDTH MON YYYY') from

Saving the highlighting of current row in Oracle Apex Classic Report after closing the dialog window

ぃ、小莉子 提交于 2019-12-08 06:33:36
问题 Good evening to everybody here! At this moment I'm working with one page in Oracle Apex (version 4.2.6.00.03). It consists of two Classic Reports — the first is a "master" one, and the second contains "details" of the former. Also there are several buttons for performing actions of inserting/updating/deleting the data. My purpose is not only to make the actions work and "details" report to refresh on choosing the row from the "master" one (I've completed these tasks), but also to manage to

How to handle unicode data in cx_Oracle and python 2.7?

有些话、适合烂在心里 提交于 2019-12-08 06:15:24
问题 I am using Python 2.7 cx_Oracle 6.0.2 I am doing something like this in my code import cx_Oracle connection_string = "%s:%s/%s" % ("192.168.8.168", "1521", "xe") connection = cx_Oracle.connect("system", "oracle", connection_string) cur = connection.cursor() print "Connection Version: {}".format(connection.version) query = "select *from product_information" cur.execute(query) result = cur.fetchone() print result I got the output like this Connection Version: 11.2.0.2.0 (1, u'????????????',

Fetch and bulk collect from a REF CURSOR returned by a procedure

旧巷老猫 提交于 2019-12-08 06:08:59
问题 I have a stored procedure that has a SYS_REFCURSOR as an OUT parameter. The signature is, for example, as follows: PROCEDURE myProc(p_someID IN INTEGER, p_cursor OUT SYS_REFCURSOR); I call this procedure from a function, where I have to copy a column named clientID from the p_cursor to a scalar nested table. I am doing as follows: CREATE OR REPLACE FUNCTION myFunction RETURN sys_refcursor IS someID INTEGER := 1234; myCursor SYS_REFCURSOR; TYPE t_clientID_nt IS TABLE OF NUMBER(16,0); clientID

How can you force an function in a where clause to execute once in oracle?

别说谁变了你拦得住时间么 提交于 2019-12-08 05:57:43
问题 I am attempting to query a rather large IP/City (3,000,000+ rows) table based on an IP address. My source IP address is dotted notation such as 127.0.0.1 and the table has two fields stored as integers such as 2130706433. So I need to convert the dotted notation to the integer in my where clause like this; select get_ip_integer('74.253.103.98') ,icb.*,icl.* from ip_city_block icb, ip_city_location icl where get_ip_integer('74.253.103.98') between icb.startipnum and icb.endipnum and icl.locid

Issue connecting Oracle 11g to SQL Server 2012 — ORA-12523: TNS:listener could not find instance appropriate for the client connection

戏子无情 提交于 2019-12-08 05:52:35
问题 I have Oracle 11g and SQL Server 2012 installed on the same virtual machine. OS is Windows Server 2012. I want to access SQL Server 2012 from Oracle. I created the machine a few days back to test the connection process before applying it on server. I had come through several issues but now I am stuck with this one. ORA-12523: TNS:listener could not find instance appropriate for the client connection I have already created ODBC Connection by the name of sqldb . kshaz is my machine name.

Optimizing row by row (cursor) processing in Oracle 11g

邮差的信 提交于 2019-12-08 05:36:05
问题 I have to process a large table (2.5B records) row by row in order to keep track of two variables. As one can imagine, this is quite slow. I am looking for ideas on how to tune this procedure. Thank you. declare cursor c_data is select /* +index(data data_pk) */ * from data order by data_id; r_data c_data%ROWTYPE; lst_b_prc number(15,8); lst_a_prc number(15,8); begin open c_data; loop fetch c_data into r_data; exit when c_data%NOTFOUND; if r_data.BATS = 'B' then lst_b_prc := r_data.PRC; end

Oracle query using Xpath to get comma separated List for same node

余生颓废 提交于 2019-12-08 05:33:40
问题 Hello Everyone, I need a help to fetch comma separated list for same node if exists in XML nodes. My XML is like this which is stored in my database:- <Event> <Detail> <List> <Element> <name>ABC</name> <salary>150</salary> </Element> <Element> <name>PQR</name> <salary>250</salary> </Element> </List> </Detail> </Event> I need to get comma separated name list (ABC,PQR ) from this using xpath oracle query. I have tried alot and when i get a way like this :- NVL(VALUE (line).EXTRACT ('/Event