Compare Non Numeric Data Using Arithmetic Operations?
Feb 22, 2013
Is there anyway to compare the non numeric data in a table to a numeric number.Want to run a query like
SELECT rank_id
FROM mas_rank
WHERE rank_code > 26 Rank_code contains numeric as well as some non numeric data
View 8 Replies
ADVERTISEMENT
Sep 14, 2011
I am fetching data in the following set
NameWeight_LWWeight_TWChange
A56 56 0
B34 NULL -34
CNULL 77 77
Here Change=(Weight_TW -Weight_LW)
I should get values as 0, -34 and 77. But I don't get this as all operations with null gives null. These are fetched data and don't exist in the form shown. I have to use these row values of "Change" further. Is there any way of obtaining these results?
View 6 Replies
View Related
May 10, 2011
I am trying to insert data in one of the tables called as tstcntr_mstr in ibpslive instance by ibpslive user.
My source tables are on ncfiiidv instance.
Query is as follows:
insert into tstcntr_mstr
(select * from tstcntr_mstr@dlink_ncfmdv)
Error that I get is remote operations not permitted on object tables or user-defined type columns.
Table tstcntr_mstr@dlink_ncfmdv contains types.
the migration of the data.
View 20 Replies
View Related
Oct 10, 2011
I have an sqlldr process running loading data into my database. I have created a trigger to run before inserts on each row to start gathering summary data from the basic underlying data. The trigger compiles ok and the procedures the trigger is calling compile ok, but when the sqlldr process runs I get errors in the log files.
Here is the sqlldr control file:
LOAD data
APPEND INTO TABLE cdr.day_tables
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(
RecordCode
,CdrStart DATE 'YYYY DDD SSSSS'
[code].......,
Next is my trigger
create or replace TRIGGER BNUMBER_SUMMARY_INS
BEFORE INSERT ON DAY_TABLES
FOR EACH ROW
DECLARE
[code]......
Next are the procedures that are called by the trigger:
create or replace PROCEDURE BNUMBER_SUMMARY
( BNUMBER IN VARCHAR2
, CALLDATE IN DATE
, CALLDURATION IN NUMBER
) AS
record_found NUMBER;
BEGIN
[code].......
The error messages I am getting are:
Record 1: Rejected - Error on table CDR.DAY_TABLES, column CDREND.
ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at "CDR.BNUMBER_SUMMARY_INS", line 6
ORA-04088: error during execution of trigger 'CDR.BNUMBER_SUMMARY_INS'
I need to find out what field it is complaining about, especially since I am not even using the cdrend field from the input record?
View 14 Replies
View Related
Apr 22, 2013
select ORDER_NUMBER from OE_ORDER_HEADERS_ALL
WHERE ordered_date=to_char(to_date(substr(ORDERED_DATE,1,10),'YYYY/MM/DD'),'DD-MON-YYYY');
Error:-ORA-01858: a non-numeric character was found where a numeric was expected
View 13 Replies
View Related
Jun 1, 2007
I get the error message mentioned in the subject with this SELECT-statement
....where (t.cfonte=14 and t.data_ultima_modifica between sysdate -4000/(24*60*60) and sysdate ) or (t.data_ultima_modifica > to_date('%TIMESTAMP%','ddmmyyhh24miss'))]]>
If I substitute %TIMESTAMP% with 310507143709 then it works
View 6 Replies
View Related
Mar 5, 2010
How to identify the columns which are different between two oracle tables. I have nearly 30 columns in each table comprising of million rows
View 11 Replies
View Related
Sep 24, 2010
select employee_id,
last_name,
salary,
(salary + (salary * .155)) AS "NEW SALARY"
from store13.employees;
In the above example, I was able to get this to work. Now I need to add another column in the query (not the table) like this:
select employee_id,
last_name,
salary,
(salary + (salary * .155)) AS "NEW SALARY",
("NEW SALARY" - SALARY) AS "INCREASE".
from store13.employees;
This errors out. It seems to have a problem using the newly referenced column "NEW SALARY" to perform another math statement.
View 6 Replies
View Related
Nov 13, 2008
I am attempting to use the following select to get a specific emplid. However, the ps_names table contains some alphabetic characters. I want to only focus on the emplid's that contains numbers. Is there a way to modify the following select to do this?
bubbagumpshrimp
"ORA-01722: invalid number"
SELECT x.y
from (select PERCENTILE_CONT(0.10) WITHIN GROUP (ORDER BY to_number(emplid)) over () y
from PS_NAMES
where emplid > '000000000' and emplid < '999999999') x
where rownum = 1;
View 6 Replies
View Related
Aug 16, 2013
I have a table and data like mentioned below.
create table emp( ename varchar2(20));
insert into emp values ('122');
insert into emp values ('abc');
insert into emp values ('0.2');
insert into emp values ('0-5');
insert into emp values ('25-30');
SQL> Select * from emp;
| ENAME |
-------------------
| 122 |
| abc |
| 0.2 |
| 0-5 |
| 25-30 |
I am running the code
SQL>select regexp_substr(ename , '^[[:digit:]]+.[[:digit:]]+$|^[[:digit:]]+$')
from emp;
AFTER RUNNING I AM GETTING THIS
| REGEXP_SUBSTR(ENAME,'^[[:DIGIT:]]+.[[:DIGIT:]]+$|^[[:DIGIT:]]+$') |
---------------------------------------------------------------------
| 122 |
| (null) |
| 0.2 |
| 0-5 |
| 25-30 |
| (null) |
Why it's not excluding '0-5' and '25-30', how I should write code to exclude this and Is there is any function in oracle to check for numeric in column and print.
View 4 Replies
View Related
Sep 12, 2012
table 1
empno, salary
1001,9800
1002,10000
1003,4000
1004,6000
table 2
sal_from, sal_to, rate
1000, 3000, 0
3000, 4500, 10
4500, 5500, 12
5500, 6500, 30
6500,999999 50
now how can i compare values from table 1 in table2 and apply RATE on table1 SALARY like (SALARY*RATE)
View 3 Replies
View Related
Aug 29, 2012
I have an requirement like below and would like to have SQL for that.
Source Table:
EMP_NO EMP_CODE
1 'A'
1 'D'
1 'E'
1 'F'
2 'S'
2 'A'
2 'W'
2 'Q'
3 'A'
3 'T'
3 'D'
3 'E'
4 'D'
4 'A'
I want to load only data which has EMP_CODE as A and doesn't have subsequent 'E' or 'F' in it. In the above source you can see EMP_NO 2 and 4 satisfy the condition and rest wont. So i want the output data like below.
Desired output:
EMP_NO EMP_CODE
2 'A'
4 'A'
View 4 Replies
View Related
Mar 12, 2012
create type nesttype as table of clob;
create table emp
(empno number,
ename varchar2(1000),
language_known nesttype
)
I want to check whether language is already there in database or not.
i have written the below query
select * from emp where language_known =nesttype('english','hindi');
i am getting the below error
SQL Error: ORA-22901: cannot compare nested table or VARRAY or LOB attributes of an object type
22901. 00000 - "cannot compare nested table or VARRAY or LOB attributes of an object type"
*Cause: Comparison of nested table or VARRAY or LOB attributes of an
object type was attempted in the absence of a MAP or ORDER
method.
*Action: define a MAP or ORDER method for the object type.
How to compare data in nested table
View 16 Replies
View Related
Jan 9, 2012
Does Oracle have a package that can handle 'big number' (bignum) arithmetic, that is, decimal digits of 300 to 1000 characters in length, or more? I know 'binary_double' can handle E+308 but that is with precision.
A project here is looking at using prime numbers and we need to store the result of multiplying up to the first 950 or so prime numbers.
View 12 Replies
View Related
Dec 7, 2010
We are getting an error : a non numeric was found where a numeric was expected sometimes when this statement is executed:
INSERT INTO training select * from temp_training where class_id='xyz';
all columns and their datatypes are the same in both the tables
however if i replace the * with the column names as shown below it seems to work fine without giving an error
insert into training (a,b,c) select a,b,c from temp_training where class_id='xyz'
wanted to understand the subtle difference between the 2 statements
View 5 Replies
View Related
May 14, 2013
I wrote an query and regarding one part, i have syntax problem, when should we seperate different arithmetic operators in a query?
for example
select density_with_desert.popp / density_with_desert.arr - sum(darea) from counytyi don't want to use variables.
View 8 Replies
View Related
Jun 1, 2010
1) how to to compare sybase table data with oracle database table data?
2) how to connect sybase database from oracle database?
View 5 Replies
View Related
Jul 26, 2011
I have a table with two columns called startsem and gradsem they are both CHAR(3). Within those colums are rows that are listed as SemesterYear. For example, F09 is Fall 2009, S09 Spring 2009, and M09 is Summer 2009. I would like to create a constraint that says GradSem must be greater than StartSem b/c no one can travel back in time to graduate. However, as you know you can compare S09 > F09 because it will treat it as a string. I thought I could use a substring and compare the last two digits as a year and that would work but how do I compare the semesters as a time frame? Because in my schema F > S because Spring 2011 comes before Fall 2011 but in reality F < S because to Oracle it is a string and the ASCII value of F is less than S. I cannot chage the coding of the database so editing the rows so they are more date friendly is not an option.
So how can I modify this database to acruately compare StartSem and GradSem.
View 7 Replies
View Related
Jan 5, 2011
CREATE TABLE SCHEDULE_DETAILS
(
SCHEDULE_ID NUMBER NOT NULL,
SCHEDULE_TYPE VARCHAR2(10 BYTE),
SCHEDULE_START_DATE DATE,
SCHEDULE_END_DATE DATE,
RUNTIME CHAR(8 BYTE),
TIMEZONE VARCHAR2(40 BYTE));
SET DEFINE OFF;
Insert into SCHEDULE_DETAILS
(SCHEDULE_ID, SCHEDULE_TYPE, SCHEDULE_START_DATE, SCHEDULE_END_DATE, RUNTIME, TIMEZONE)
Values
(1970, 'Daily', TO_DATE('07/26/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE('01/26/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), '13:58 ', 'America/New_York');
[code]........
Taking Today date and timezone as EST, I need to run a select that shows all the rows , where sysdate falls in between
Start_date and End_date and RunTime, ( run time is basically the Local time of the TimeZone Column)
Basically we should Display rows by checking/Converting, Start_date||End_date||Runtime||timezone with Sysdate(est) then display.
From the Above Data these rows should be Displayed by that select, how to compare this data with sysdate and display.
SCHEDULE_IDSCHEDULE_TYPESCHEDULE_START_DATESCHEDULE_END_DATERUNTIMETIMEZONE
1970Daily7/26/20101/26/201113:58 America/New_York
2588Daily10/18/20104/18/201115:50 America/New_York
3567Daily12/8/20106/8/20118:40 America/New_York
3386Daily12/27/20106/27/20111:0 America/New_York
1973Daily8/3/20102/3/201111:25 America/New_York
2565Daily9/7/20103/7/20117:0 America/New_York
3580Daily12/20/20106/20/201117:0 America/Chicago
3167Daily11/30/20105/30/20111:0 US/Alaska
3390Daily12/30/20101/15/20117:00 Asia/Calcutta
For Example, Below rows shouldn't come, Since it's end date is less than Sysdate.
SCHEDULE_IDSCHEDULE_TYPESCHEDULE_START_DATESCHEDULE_END_DATERUNTIMETIMEZONE
2579Daily9/17/20109/18/201011:32 America/New_York
View 2 Replies
View Related
Aug 13, 2012
I would like to run below query on all tables, however it doesnt work on clob and long datatypes
select * from owner.table_name
minus
select * from owner.table_name@remote_db;
from dba_tables
where owner in ( '....');
ORA-00932: inconsistent datatypes: expected - got CLOB
How can I compare the data of clob and long datatypes using dblink ?
View 2 Replies
View Related
Jun 17, 2013
I have a table which is updated with new records in each 15minutes from network. In order to get the accurate information I must do some arithmetic calculations on some variables.
For example, if the value for column A is 10 @9.45AM and 15 for @10AM the real result should be 15-10=5 for 10AM; because the values are cumulative so I need to subtract. Similar to this I have same operations for 9 more attributes in my table as well.
In order to handle this I used view and did necessary operations by using joining table like this (table name is Operations lets say and id is Primary Key)
create view ....
...
from Operations current, Operations prev
where current.datetime(+) = prev.datetime - 1 / 96
and current.id = prev.id
When I use this view, the simple select query takes about 15min since I have 25GB record for this table. What can I use instead of this join and solve cumulative values issue?
View 3 Replies
View Related
Dec 16, 2011
I am creating an stored function which has to do some inserts in the meanwhile, and return after all the work has done, an UDT (2 or 3 columns of NUMBER datatype).
With this scenario I have an problem. The DML operations are not supported by and "SELECT * FROM Table(MyProc(args))". I have to use this "SELECT * FROM Table(MyProc(args))" because I need to pass the stored function results directly to an dataset.
Using a Stored Procedure it gives no errors, but the arguments must be passed like OUT params, and it is not what I want.
My question is:
Is there any other way to get a result (UDT) of an Stored Function (that makes Inserts) into a DataSet?
View 12 Replies
View Related
Feb 11, 2011
Is there any way to know Last Commited DML Operations Over a table?
View 1 Replies
View Related
Aug 20, 2010
In the example below I believe I have created a Nested Table of PL/SQL type and have tried various references to get the SET operation to work, line containing MEMBER OF. Taking the example below from the oracle documentation I have two questions.
1) As I understand it I should be able to use SET operations on Nested tables of PL/SQL types, (I am not using the CREATE OR REPLACE DDL statement prior to the DECLARE block.).
Is this correct?
2) I am assuming that I have to reference the record, can I reference by its type / row instance or can I only retrieve the record like a Cursor Fetch solution, (which would defeat the purpose.).
Is this a SQL to PL/SQL <> PL/SQL to SQL problem?
download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/collections.htm
Example 5-24 Comparing Nested Tables with Set Operator
SET serveroutput ON
DECLARE
answer BOOLEAN;
[code]...
View 1 Replies
View Related
Apr 12, 2013
I created a table with a column "id" and values for this column is attached a sequence. And now i need, if any value deleted from the table the column "id" will need to be sequence.
ex:
id name
-- -------
1 xxxx
2 yyyy
3 zzzzz
4 pppp
5 rrrrrr
if i delete
delete from test where id=4;
then automatically.. "id" column values will again in sequence... like this
id name
-- -------1 xxxxx
2 yyyyy
3 zzzzzz
4 rrrrrr
note: in the above if i delete the id=4 from the table again it will have be in sequence and if i inserted the again it has to take the next value continue to sequence....
ex : insert to test values(seq_name.nextval,'tttt');
id name
-- -------
1 xxxxx
.
.
.
4 rrrrr
5 ttttt
View 5 Replies
View Related
May 25, 2010
Doing some data conversion at the moment and using V$SESSION_LONGOPS to predict when the current task will be finished so I can run the next one.
V$SESSION_LONGOPS seems to have only the last 16 long operations for the session. Older operations are automatically purged. My bigger tables have 32 partitions, so after the first 16 are processed, I cannot tell which partition I am up to.
Googling "old longops" and "longops history" didn't work, nor did the same searches on this site. The Oracle Reference manual section on V$SESSION_LONGOPS did not mention that older entries are purged.
View 3 Replies
View Related
Aug 16, 2012
I am trying to run spatial operations through dblinks. See the example query below
select a.OGC_GEOMETRY.sdo_gtype from <table>@dblink a where sdo_nn(a.OGC_GEOMETRY,mdsys.sdo_geometry(2001,null,mdsys.sdo_point_type(0,0,null),null,null),'sdo_num_res=1')='TRUE'.
Query fails with the following error
ORA-13249:
ORA-06512: at "MDSYS.MD", line 1723
ORA-06512: at "MDSYS.MDERR", line 17
ORA-06512: at "MDSYS.PRVT_IDX", line 9
*13249. 00000 - "%s"*
**Cause: An internal error was encountered in the extensible spatial index*
component. The text of the message is obtained from some
other server component.
**Action: Contact Oracle Support Services with the exact error text.*
Same Query runs fine in the original database but fails with dblinks. Is it possible to run spatial operations through dblink?
View 4 Replies
View Related
Sep 25, 2008
When attempting to create the following table I recieve the error
count(m.mission_id) < 4
ERROR at line 9:
ORA-00905: missing keyword.
assist in order to resolve this error.
CREATE TABLE AM_agents
AS
(
SELECT
a.first_name || ' ' || a.last_name fullname,
'agent' person_type,
[code]...
View 4 Replies
View Related
May 15, 2013
I'm a software developer, not an Oracle DBA
Our product runs a lot of stored procedures in the background to do various things. These stored procedures obviously include a ton of select statements, insert statements, etc. Some of them get pretty complex. Once in a while, we run across the following error: "ORA-03127: no new operations allowed until the active operation ends(3127)." Once this happens, pretty much everything breaks with this error for a while. Eventually (LOOOONG time), this error "resolves itself" and things start working again. Conceptually, I understand that there seems to be some blocking operation on the DB, but because we run a LOT of stored procedures and SQL statements, it's extremely difficult to pin this down.
View 7 Replies
View Related
Sep 27, 2007
I am a novice in oracle
I have 2 columns in my table
->Col1 with experience in years entered as an integer
->Col2 with current date
I need to add another column as a date value adn for that i need to subtract Currentdate-Col1 when i tried currentdate-Col1 it just subtracted the days i need the formula to subtract years and give a date
I have worked in DB2 and all u need to do there was add the keyword years at the end but in oracle the same does not work
View 8 Replies
View Related