oracle10g

Return Message of Error code in Oracle Stored Proc

冷暖自知 提交于 2019-12-06 08:25:43
问题 The below procedure (in Oracle 11g release 1) accepts a sql as a parameter & returns its return code. Returns 0 if success Returns 1 if no update or no delete performs Returns actual error code in case of failure. How can I change below procedure to return me another out param say "return_message" which will contain short description of oracle internal error message? In case of success, it should say "success" and in case no delete/updates performed, it should say "nochange" CREATE OR REPLACE

Invoking a function call in a string in an Oracle Procedure

醉酒当歌 提交于 2019-12-06 07:53:42
I writing an application using Oracle 10g. I am currently facing this problem. I take in "filename" as parameter of type varchar2. A sample value that filename may contain is: 'TEST || to_char(sysdate, 'DDD')'. In the procedure, I want to get the value of this file name as in TEST147. When i write: select filename into ffilename from dual; I get the value ffilename = TEST || to_char(sysdate, 'DDD') whick makes sense. But how can I get around this issue and invoke the function in the string value? Help appreciated. Thanks. It's easy enough to dynamically execute a string ... create or replace

CHR(0) in REGEXP_LIKE

本秂侑毒 提交于 2019-12-06 07:36:07
I am using the queries to check how chr(0) behaves in regexp_like. CREATE TABLE t1(a char(10)); INSERT INTO t1 VALUES('0123456789'); SELECT CASE WHEN REGEXP_LIKE(a,CHR(0)) THEN 1 ELSE 0 END col, DUMP(a) FROM t1; The output I am getting like this - col dump(a) ----------- ----------------------------------- 1 Typ=96 Len=10: 48,49,50,51,52,53,54,55,56,57 I am totally confused, if there is no chr(0) as shown by the dump(a), how regexp_like is finding the chr(0) in the column and returning 1? Shouldn't it return 0 here? CHR(0) is the character used to terminate a string in the C programming

ORA-00907 when dynamically creating a view in PL/SQL and using a CLOB

时光毁灭记忆、已成空白 提交于 2019-12-06 07:18:27
This is one of those situations where you get an unhelpful error message back from Oracle. My situation is as follows: I'm dynamically creating a view in PL/SQL. I build a string and use EXECUTE IMMEDIATE to create the view. The string is so long that I use a CLOB to store it. When I run the code below in TOAD I get the unhelpful ORA-00907: missing right parenthesis error. Manually creating the view in TOAD (without the EXECUTE IMMEDIATE) gives no problems. My feeling is that the length of the string is a factor here as I've successfully created views with shorter strings (and also by using to

pl/sql - can collection loop through column names?

☆樱花仙子☆ 提交于 2019-12-06 07:01:42
问题 The output from the below code is: |LAT|MISC|SID|NO MIN_LENGTH|1|2|1|1 MAX_LENGTH|6|6|4|2 The output is as I expect, but is there anyway to loop through the columns using an index (ie. j) instead of doing RESULTS(I). MAX_LENGTH , RESULTS(I). MAX_LENGTH etc ? The concern is that when adding extra columns to the 'R_RESULT_REC' record, another loop is required. set serveroutput on DECLARE TYPE R_RESULT_REC IS RECORD (COL_NAME VARCHAR2(100), MIN_LENGTH NUMBER, MAX_LENGTH NUMBER ); TYPE tr_RESULT

ORACLE Constraint to allow Null Value, IF

*爱你&永不变心* 提交于 2019-12-06 06:49:48
问题 I'm working with oracle for the first time, and I have a table called ExpenseReport which stores details about expenses. I want Nulls to be allowed for ApprUserNo IF ERStatus = 'PENDING' Any help would be greatly appreciated, I've been trying to sort this all morning CREATE TABLE ExpenseReport ( ERNo NUMBER(10) NOT NULL, ERDesc VARCHAR2(255) NOT NULL, ERSubmitDate DATE NOT NULL, ERStatusDate DATE NOT NULL, ERStatus VARCHAR2(8) DEFAULT 'PENDING' NOT NULL, SubmitUserNo NUMBER(10) NOT NULL,

sql Optimizer for Large Db Table

左心房为你撑大大i 提交于 2019-12-06 05:45:24
i have table that has millions of rows that i need to join to do selects. the response time is not so good, how can i improve its response? i have tried adding index to the columns i do select by, is there a tool i can use to optimize the sql or how can i diagnose on the bottlenecks of the sql and improve it? any suggestion would be very appreciated. i am using oracle server 10g and using asp.net as my client. is there any other kind of indexing helpful on tables with millions of rows? You should probably start with EXPLAIN PLAN . Use the EXPLAIN PLAN statement to determine the execution plan

Implementing Multithreading in Oracle Procedures

怎甘沉沦 提交于 2019-12-06 05:38:05
问题 I am working on Oracle 10gR2. And here is my problem - I have a procedure, lets call it *proc_parent* (inside a package) which is supposed to call another procedure, lets call it *user_creation* . I have to call *user_creation* inside a loop, which is reading some columns from a table - and these column values are passed as parameters to the *user_creation* procedure. The code is like this: FOR i IN (SELECT community_id, password, username FROM customer WHERE community_id IS NOT NULL AND

SQL Error: ORA-01401: inserted value too large for column

岁酱吖の 提交于 2019-12-06 05:23:53
I am getting issue while inserting a new record to the table in Oracle database. The error description says- SQL Error: ORA-01401: inserted value too large for column How would I come to know that which column is having large value as I am having 60 columns in the table. SQL Error: ORA-01401: inserted value too large for column You are trying to insert value larger than the specified size for the column. How would I come to know that which column is having large value as I am having 60 columns in the table. The error will certainly have the table and column name with the actual size being

Restricting number of records allowed in a table in a way which can't be subverted

99封情书 提交于 2019-12-06 04:54:05
We have a web application (Grails) which we are going to sell licenses for based on the number of users. There is a table in the database (Oracle 10g) which holds users. Customers will host their own copy of the software and database. Can someone suggest strategies for limiting the number of records which are allowed to exist in the user table in a way which can't reasonably be subverted by the customer? Thanks. You should at least consider avoiding all technical means here and instead insisting that your customer sign an SLSA with an audit provision, and then audit here and there. All these