oracle10g

PL/SQL use VARRAY in IN CLAUSE

半世苍凉 提交于 2019-12-01 03:40:58
Is it possible to use VARRAY in IN CLAUSE of pl/sql? Yes, you can, provided that the VARRAY type is a global type (and not local to some PL/SQL code): CREATE OR REPLACE TYPE str_tab_type IS VARRAY(10) OF VARCHAR2(200); DECLARE l_str_tab str_tab_type; l_count NUMBER; BEGIN l_str_tab := str_tab_type(); l_str_tab.extend(2); l_str_tab(1) := 'TABLE'; l_str_tab(2) := 'INDEX'; SELECT COUNT(*) INTO l_count FROM all_objects WHERE object_type IN (SELECT COLUMN_VALUE FROM TABLE(l_str_tab)); END; / user3711142 I have the same Problem, but I don't want (and am not allowed) to define a global TYPE When

What is the maximum statement length in Oracle

半腔热情 提交于 2019-12-01 03:32:28
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. There is no fixed number. See "Logical Database Limits": http://docs.oracle.com/cd/B19306_01/server.102/b14237/limits003.htm "The limit on how long a SQL statement can

Getting “Invalid column type” excecption, while using NamedParameterJDBCTemplate for insertion

笑着哭i 提交于 2019-12-01 03:31:46
问题 I am using below code while inserting a row into database(oracle 10g xe,jar: ojdbc14.jar) String sql = "INSERT INTO SPONSOR_TB(ID,NAME,INDUSTRY_TYPE,IS_REPORTING_SPONSOR,IS_NOT_SOLICITE) VALUES(SEQ_SPONSOR_ID.NEXTVAL,:NAME1,:INDUSTRY_TYPE,:IS_REPORTING_SPONSOR,:IS_NOT_SOLICITE)"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("NAME1",sponsor.getName()); paramSource.addValue("INDUSTRY_TYPE", sponsor.getIndustryType()); paramSource.addValue("IS_NOT

MINUS Operator in oracle

南楼画角 提交于 2019-12-01 03:23:43
MINUS Operator I have 2 tables A and B. SELECT COUNT(*) FROM (SELECT * FROM tableA) returns 389 SELECT COUNT(*) FROM (SELECT * FROM tableB) returns 217 SELECT COUNT(*) FROM (SELECT * FROM tableA INTERSECT SELECT * FROM tableB) returns 0 SELECT COUNT(*) FROM (SELECT * FROM tableA MINUS SELECT * FROM tableB) returns 389 SELECT COUNT(*) FROM (SELECT * FROM tableB MINUS SELECT * FROM tableA) retuns 89 Can someone please explain why does the last query return 89 and not 217? MINUS takes the first result set, and removes any that exist in the second result set; it also removes any duplicates . In

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

断了今生、忘了曾经 提交于 2019-12-01 03:18:15
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 Is In F 6 Births F 7 Classified F 8 Please help me understand how is it happening? In relational

Parallelizing calls in PL/SQL

巧了我就是萌 提交于 2019-12-01 03:14:46
问题 I have a package with a proc that will execute a number of other procedures, like so: CREATE PACKAGE BODY pkg IS CREATE PROCEDURE do IS BEGIN other_pkg.other_proc; other_pkg2.other_proc2; other_pkg3.other_proc3; END; END; Is there any way to have the procedures execute in parallel rather than serially? EDIT: Is this the proper way to use DBMS_SCHEDULER in this instance: CREATE PACKAGE BODY pkg IS CREATE PROCEDURE do IS BEGIN DBMS_SCHEDULER.CREATE_JOB('job_other_pkg.other_proc', 'STORED

Alter a nonunique index to a unique index

点点圈 提交于 2019-12-01 02:47:53
I have a few non-unique constraints that I want to alter into unique constraints ( business rules have changed since the data model was made ). Is there any way to do it with out dropping and recreating as a unique constraint? I was thinking there would be an option in the alter constraint command, but I have not found anything. Thanks!! You can't modify a constraint in the way you wish you can only drop and recreate it. If you want to do this with no downtime then look into the DBMS_REDEFINITION package. You cannot convert a non-unique index into a unique index. (It's difficult to say what

Why we can't execute stored procedure in select statement in oracle? is there any strong reason?

◇◆丶佛笑我妖孽 提交于 2019-12-01 01:47:15
create or replace procedure pr is v_date date; begin select sysdate into v_date from dual; DBMS_output.put_line(v_date); end pr; Procedures are not allowed in SQL statements because mixing declarative and imperative programming styles is confusing. A SQL statement is a list of conditions - it's up to Oracle to decide how to produce the result set that matches those conditions. A PL/SQL stored procedure is a set of instructions that change things in a very predictable way. In the below example, how many times should pr be executed? Is it executed before or after id = 1 ? If SQL statements had a

ORA-22275: invalid LOB locator specified

混江龙づ霸主 提交于 2019-12-01 00:40:31
I have huge Oracle function which is used to calculate data from 6 tables. create or replace FUNCTION STATISTICS_FUNCTION(NAMEIN IN VARCHAR2 ) RETURN CLOB AS LAST_60_CPU NUMBER; ............. LINE CLOB; CURSOR LAST_60_CPU_CURSOR IS ................. BEGIN LINE := EMPTY_CLOB(); DBMS_LOB.CREATETEMPORARY(LINE,true); OPEN LAST_60_CPU_CURSOR; LOOP FETCH LAST_60_CPU_CURSOR INTO LAST_60_EVENT_DATE, LAST_60_CPU; .................... DBMS_LOB.APPEND(LINE, TO_CHAR(LAST_60_EVENT_DATE)); DBMS_LOB.APPEND(LINE, 'I'); DBMS_LOB.APPEND(LINE, TO_CHAR(LAST_60_CPU)); DBMS_LOB.APPEND(LINE, CHR(10)); END LOOP;

MINUS Operator in oracle

喜你入骨 提交于 2019-11-30 23:10:06
问题 MINUS Operator I have 2 tables A and B. SELECT COUNT(*) FROM (SELECT * FROM tableA) returns 389 SELECT COUNT(*) FROM (SELECT * FROM tableB) returns 217 SELECT COUNT(*) FROM (SELECT * FROM tableA INTERSECT SELECT * FROM tableB) returns 0 SELECT COUNT(*) FROM (SELECT * FROM tableA MINUS SELECT * FROM tableB) returns 389 SELECT COUNT(*) FROM (SELECT * FROM tableB MINUS SELECT * FROM tableA) retuns 89 Can someone please explain why does the last query return 89 and not 217? 回答1: MINUS takes the