SQL & PL/SQL :: Overriding Pre-defined Functions In Oracle
Apr 11, 2012
Can we override the pre defined functions in oracle. I am able to do this in my schema. But if DB server contains more than one schema do I need to write the same procedure in all schemes.
we can call the same procedure with schema name from different schemes also . But is there any way to over ride the actual function provided by oracle (just like over riding the equals method of object class in java).
create or replace function to_number(var varchar2) return number
is
no number := var;
begin
return 99999;
end;
SQL> select to_number(' 234 ') oracle_function , dbo.to_number(234) user_function from dual;
ORACLE_FUNCTION USER_FUNCTION
--------------- -------------
234 99999
View 4 Replies
ADVERTISEMENT
Sep 26, 2012
In one of the interviews , I have attended the guy asked me to write a user defined function which will take the column name and list all the values .
For example
Table Name:Employees
Column Name: Employee_Name
Employee_name
Scott
Ivgun
Jack
Shane
The query should be in this fromat
SELECT col_agg(Employee_name) emp_name from Employees;
The output should be
Emp_names
scott,ivgun,jack,shane
View 6 Replies
View Related
Jun 22, 2010
I am migrating sybase to oracle database. A Java developer needs money datatypes.I said to them, please change the cast(<value> as number(19,4) in java code side. but they are not accepted because money data type is used most of the places.
select cast(0 as money) from bank_trans; this sql statements present in java code. I need to create user defined type is equivalent to money datatype.
My steps
I have create user defined data types
create or replace type money as object(money as numbeer(19,4)
select cast(0 as money) from dual;
it shows inconsistent datatypes error.
create or replace type money is table of numbeer(19,4);
select cast(0 as money) from dual;
it shows inconsistent datatypes error.
View 10 Replies
View Related
Jan 22, 2013
I am using oracle 10g version 10.2.0.1.0.
Can I use user-defined functions in my sql*loader control file and load in DIRECT path mode?
View 1 Replies
View Related
Jan 12, 2012
If a user defined function in Oracle may throw and catch exceptions depending on input, now does the Oracle logs the exception? Fundamentally we are asking if Oracle logs any random DML errors (not bulk operation). We hope not, as we do not want our client DBA get concerned. There might be many levels of settings in Oracle to log or not log. So if Oracle may log it depending on setting, how do we suppress it either at Oracle specific schema level, or function level?
This is my user defined function:
create or replace FUNCTION ISNUMERIC(char_in CHAR) RETURN NUMBER IS
n NUMBER ;
BEGIN
n := TO_NUMBER(char_in);
RETURN 1;
EXCEPTION
WHEN OTHERS THEN
RETURN 0;
END;
View 2 Replies
View Related
Sep 24, 2012
Is it Possible to create User - defined Search forms in runtime oracle forms 6i . If One Having sample Forms
View 1 Replies
View Related
Aug 24, 2012
Is there any function like fn:local-name(.) in oracle XPATH functions. I am new to Oracle & migrating procedure from SQL server to oracle where procedure taken XML script as input.
I need to convert below SQL server select statement to Oracle.
SELECT converseUID,
'Distributed',
cast(ServiceCalls.query('fn:local-name(.)') as varchar(100)),
1,
WIP.ServiceCalls.value('(TotalTime)[1]','int'),
WIP.ServiceCalls.value('(Status)[1]','varchar(100)'),
[code].......
View 5 Replies
View Related
Jan 20, 2011
the data in the column is in below format
---------------------
2/10/2009 9:28:41 PM
mm/dd/yyyy
my requirement is
--------------------
20090210
YYYYMMDD
View 5 Replies
View Related
Apr 26, 2013
I am developing android application connected to Oracle database using PHP, and I use PL/SQL statements with semantic technologies provided in Oracle(specifically, SEM_MATCH, SEM_MODELS, SEM_RULEBASES or something like this).
However, it doesn't work properly...the connection between android and Oracle works well, though. Also, the query statement is implemented well in the sql developer.The whole php code is shown below :
*<?php*
function db_connect()
*{*
*$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 203.249.105.20)(PORT = 1521)))(CONNECT_DATA=(SID=orcl)))";*
[code]...
View 6 Replies
View Related
Jan 2, 2013
writing a manual date validation function without using inbuilt oracle functions.I am planning to write this function in PL/SQL.
View 17 Replies
View Related
Apr 10, 2011
it is a good practise to assign different profile for oracle database users according to their job functions.what could be the resons for that?
View 3 Replies
View Related
Jul 5, 2012
i am running 11.2.0.1 on HP-UX PA-RISC (64-bit). My Memory max target is defined as 34 GB and memory target is 32 GB on the database. The host has 256 GB physical memory. i see memory utlization is almost 90% used when seen from Grid Control on the host and wondering, what's going on? when i see into more details, i see the following 3 HP Processes consuming around 3.6 GB memory and rest very small is consumed by Oracle processes. Who's using the rest of the memory?
View 3 Replies
View Related
May 26, 2011
In SQL server the cursor is defined to retrieve row by row and process it. We can fetch records as FIRST, LAST, NEXT, PREVIOUS and SCROLL like that. Can we do the above in oracle. Else what is the use of cursor in Oracle. I know that it is a private area in which the records are processed.
View 6 Replies
View Related
Jun 19, 2012
I am trying to create a new data type but keeping getting a ORA-0902 invalid data type error. I am using the example show at:
Guess I cannot post a link until I have posted more than 5 messages so here is the link another way:
www(dot)psoug.org/reference/type.html
Specifically, all the steps work up to Create Table which fails with the error.
By work -- I mean the type gets created & the 3 select statements prior to Create Table confirm the existence of the ssn_t data type.
View 5 Replies
View Related
Oct 30, 2012
I dont know where was the mistake, getting column ambiguously defined error
CREATE OR REPLACE PROCEDURE FLXUSER.testgg
AS
BEGIN
/*----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------*/
BEGIN
[code]....
View 7 Replies
View Related
Jun 19, 2012
I am trying to create & use a new data type but keep getting a ora-0902 invalid data type error running on 10g express. The create type and select statements execute fine and select confirms the ssn_t is a type. The create table statement fails with the invalid data type error.
Here is an example.
CREATE TYPE ssn_t AS OBJECT ssn_type CHAR(11));
SELECT object_name, object_type
FROM user_objects WHERE object_type = 'TYPE';
CREATE TABLE Z (A CHAR(4), B SSN_T);
View 14 Replies
View Related
Jun 28, 2010
recently i saw SYS_CONTEXT function in one package.
query, which can display the All Namespaces defined in database.
View 2 Replies
View Related
Oct 16, 2006
i have flash item on canvas weh nthe nw form insatance i have that erros frm 41344 ole object not defined
View 5 Replies
View Related
Oct 13, 2009
That is I have created the User Defined Data Type as following. CREATE OR REPLACE TYPE Bit_Type AS OBJECT(Bit NUMBER(1,0));
After completing this creation of new UDT, I am trying to create the table with this UDT as follows, CREATE OR REPLACE TABLE Sample_Bit ( RegID Bit_Type);
I received an Error Message like:
SQL Error: ORA-22913: must specify table name for nested table column or attribute
22913. 00000 - "must specify table name for nested table column or attribute"
*Cause: The storage clause is not specified for a nested table column or attribute.
*Action: Specify the nested table storage clause for the nested table column or attribute.
View 1 Replies
View Related
Dec 28, 2010
Is it possible to easily set up a single User Defined Metric, to monitor all the users quotas? I know I can do it, if I make individual metrics for each user. But was hoping there was a simple way of combining them all into a single metric.
I am using Oracle 10G2 Standard Edition on a windows 2003 Server.
View 1 Replies
View Related
Aug 5, 2010
I am getting an above errors while starting the emctl start dbconsole..
View 9 Replies
View Related
Jun 29, 2011
I'm calculating a Z score based on some simple numerical data thus:
create table t (id number, val number);
insert into t values(1, 1795);
insert into t values(2, 1753);
insert into t values(3, 1743);
insert into t values(4, 1876);
insert into t values(5, 1848);
[Code] .....
the logic is quite simple - calculate a moving average over the previous 12 rows, and a stdev over the same window. Then subtract the prior row's moving average from the current value, and divide by the prior row's stdev.
The issue is I want to expose this logic in a BI tool (OBI EE v10g), meaning I can't use the nested analytic functions. How to achieve this logic in a single analytic pass? The sql above took about 2 minutes to write this morning, then I've spent all day looking at user-defined aggregate functions, but haven't even been able to get the first step, the moving average, working. I can understand that I can probably create an udaf to replicate the avg(val) over (order by id ROWS BETWEEN 11 PRECEDING AND 0 FOLLOWING) functionality, but I can't see how to bundle the logic for the other three steps in the calculation into this.
From what I've read, the ODCIAggregateMerge should allow me to combine different threads that can return the different values I need for the current row calculation. Is this correct?
The only example udafs I can find are either not relevant (STRAGG) or very simple (ie don't appear to invoke multiple passes). I've also had a look at the COLLECT function, but again I can't see a way to use this.
View 6 Replies
View Related
Jul 24, 2012
I migrate schema with data from oracle 10gR2(Windows) to oracle RAC 11gR2 (Linux).My JOBS are created but they are not running on defined schedule. but they run manually successful.
----script of my job are as below --------
BEGIN
SYS.DBMS_SCHEDULER.DROP_JOB
(job_name => 'JHON.TAX_IT);
END;
/
[code]...
View 6 Replies
View Related
May 3, 2011
I have designed a Login form which takes username, password and connect string is hardcoded.I have compiled it, made an fmx file. created a shortcut to desktop. given the BIN path in shortcut.
when i want to lauch it, oracle's default login popup is shown.It can be by passed while defining username/password@string in shortcut properties but it reveals the password. every one can access it. I want to launch my own form without logging in to oracle. how can i avoid default login popup?
View 8 Replies
View Related
Jan 25, 2011
Can we able to declare a user define exception name as per defined exception name?Ex: we have predefined exception called :"NO_DATA_FOUND "
Now in my PL/SQL block can i able to declare "NO_DATA_FOUND" like
Begin
no_data_found exception;
//statements
raise no_data_found;
end
View 6 Replies
View Related
Apr 12, 2012
I have made a function to add two number create or replace function add_num(a in number, b in number) return number
as
begin
return a+b;
end;
/
i run it via
select add_num(2,5) from dual;
my question is how to call add_num in procedure.
View 9 Replies
View Related
Jun 20, 2012
I am getting ORA-00918: column ambiguously defined error when running the below SQL query. I am gettig this error at the last line of code where v1.objectid=v2.parent_object_id
I have not written this query so i find difficult to debug it. Also i am not that well verse with SQL
select distinct v1.UNIQUE_DOC_NAME,v1.UNIQUE_DOC_NAME_1,v1.vendor_object_name,v1.display_name,v1.document_description,
[Code].....
View 10 Replies
View Related
Aug 21, 2012
How to view the number of locks defined for a database? I am using Oracle 10g.
How to calculate the number of locks for a given sql select statement?
say for example,
select a.eno,b.ename,c.salary,d.dob,e.address
from a,b,c,d,e
where...
...
..
Assume all of them are row level locking.
I want to calculate the number of locks . How many locks will be held while running the above query?
View 16 Replies
View Related
Aug 25, 2012
Through sql*plus, how can I copy a user-defined type from other schema to mine?
I've granted the execute object privilege over the user-defined type to my user, so I can use the type.
I know I can manually write and create the type, but I wanna learn (if exist) a statement to copy the user-defined type, something like:
CREATE TABLE x2 AS
(SELECT *
FROM x1);
I'm testing ORACLE DATABASE 11g R2 over Windows O. S.
View 3 Replies
View Related
Nov 25, 2012
How can I apply a user metric for DB (single database) using a script or cli?
clear my question:
Can I create a User Defined Metric using SQL code, and not via the graphical interface?
View 1 Replies
View Related