oracle

"SELECT 1 FROM ... " in oracle returns a decimal type

I'm getting a datatable from sample query below in ORACLE "SELECT 1 AS X FROM ... " when i select the X by using dr.Field("X"), it gives me error. I've found out that the it returns as decimal datatype. Using the same statement in MSSQL has no problem, i've got the int datatype. Any workaround or solution to this? ...

Executing oracle queries in Shell Script

Please tell me how can i excute an oralce query inside a shell script.I am writing a shell script where I need to execute the oracle queries and scripts inside the shell script. What is the purpose of these lines sql_file=sachin.sql cat <<!SQL > $sql_file select $1 from dual; exit; !SQL I think they are creating a new...

table join where

Table1 t10 (id) id --- 1 2 table t11(a1,a2,a3) a1 a2 a3 ---------- 1 10 a 1 10 b 1 11 b 1 12 c 2 20 d 2 21 e select * from t10 a,t11 b where a.id = b.a1 how to display id a1 a2 a3 -------------- 1 1 10 a 1 1 10 b //(not display this row) 1 1 11 b //(not display this row) 1 1 12 c /...

100 billion records per day in Oracle - is this a problem?

A customer wants me to copy 100 billion records into an empty Oracle database. Almost all records have about 6 fields, only one of them is a varchar-field, and 99.99% of these varchar fields contain null values. He wants this to be done every day. What kind of Oracle server is needed for that, and are there any special things that I need...

OCI: Determine length of text representation of query columns

My goal is to execute a query (SELECT), fetch results and output them as text. Query is given as a parameter and can be e.g. select * from t. I use OCIStmtPrepare and OCIStmtExecute, then I can describe columns of the query by OCIParamGet and series of OCIAttrGet. Suppose I get OCI_ATTR_DATA_TYPE = 12 (DATE) for one of the columns. Then...

PL/SQL Procedure and a crystal report

Dear All, I am trying to use the following procedure as a datasource for my crystal report. The query works as I expected but the problem is I can't figure out how to fetch back the data from those dummy tables - IFS_PR_DUMMY_TAB and IFS_PR_DUMMY2_TAB CREATE OR REPLACE procedure dummy9_IFS_FR2_Sales (cdate IN date) as acontract custo...

Are there different methods to call Java from Oracle Application Express

Friends, I'm working on a requirement where I need to call a Java API from Apex. The solution I put forward was to create a Java class, store it the database and add a PL/SQL wrapper and then use it. Which is pretty much what is described here. Whilst I am happy with this, I am interested to know if this is the only method? are ther...

Are these tables too big for SQL Server or Oracle

Hey all, I'm not much of a database guru so I would like some advice. Background We have 4 tables that are currently stored in Sybase IQ. We don't currently have any choice over this, we're basically stuck with what someone else decided for us. Sybase IQ is a column-oriented database that is perfect for a data warehouse. Unfortuna...

Oracle's to_number - What's wrong?

Hey guys, What is wrong with the below format specifier for to_number? SELECT TO_NUMBER('0,22', '0,99') * 100 FROM DUAL; The result is 2200 instead of 22 -- what am I doing wrong? ...

... where count(col) > 1 ...

I have a table like this: +-----+-----+-------+ | id | fk | value | +-----+-----+-------+ | 0 | 1 | peter | | 1 | 1 | josh | | 3 | 2 | marc | | ... | ... | ... | I'd like now to get all entries which have more than one value. The expected result would be: +-----+-------+ | fk | count | +-----+-------+ | 1 | 2 ...

Oracle Stored Procedure with out parameter using Nhibernate

How can I access the value of an out parameter of an oracle stored procedure in the .net code - Oracle stored procedure being called via Nhibernate? Sample working code would help. ...

Eval compare of two values to FALSE only when both are not null and don't Match

Where clause: I should test column against value in Proc, but if at least one of them is null it should be TRUE as a result. Only when BOTH NOT NULL (it's Integer values for an ID column in a table) should the result of the compare be FALSE. Now I have this: ... and nvl(nvl(b.account_id, account_id_), 0) = nvl(nvl(account_id_, b.accoun...

SQL Query problem

Consider two table.Employee and Project.Employee table has fields like eid,ename.Project table has fields like pid,pname.Now,since an employee can work on many projects and a project can be done by many employees, therefore,as evident,there is a many to many relationship b/w the two tables.Break the many to many,and create a new table ca...

PL/SQL...if inside a select?

I'm pretty new when it comes to PL/SQL, and I have to modify someone else's stored procedure. Is it possible to add an if statement in the middle of a select? The procedure I have tries to open a cursor and select a bunch of stuff from different tables into it (don't ask me why they didn't use a join) and return the cursor. The thing ...

How to get the dependency of jobs in SQL Server?

Hi, How can we find the job dependency in SQL server. Therotically basing on the success of first one job the other job begins. Thanks a lot in advance!! ...

How to retrieve employees belonging to more than one Owner using Oracle SQL

Hi, I have a situation in oracle where I have two tables - Table A and Table B. Table A has the following columns (aid, owner_id, app_id) and Table B has the following columns (bid, aid, emp_no) Table B has a foreign key (aid) back to Table A. Based on the above tables, I am trying to write a query where an emp_...

Hexadecimal sequence in Oracle

Hi all, I would like to generate 16 char length hex decimal value as sequence. My database is Oracle and would like to know is it possible to do so? I checked the SEQUENCE in Oracle but I think its only for numericals. Any idea would be great help. Thanks in advance, Abdel Olakara ...

Concurrency / Synchronization question

I have 2 programs running on 2 different machines. Each program has a method called updateRecord that does the following 2 things: 1. Do a SELECT query on a particular record Z 2. Do a UPDATE query on the same record. If these 2 queries are in the same transaction (between beginTransaction and commitTransaction) does it guarantee proper...

ODP ADO.NET driver returns decimal with extra zero in string representation

Hello, Today's problem is as follows: we have a table in an Oracle database. The table contains a field that is of the type Number(18, 3). On the surface, both saving and loading data from said field work perfectly. However, further inspection reveals, that numbers that have three decimal digits in them, e.g. 500.001, are read from the...

SQL:printing my own messages depending on query output

how can i print my own messages depending on the output of a SQL quesry. Eg: print "got it" when select * from emp wherempno=10; return atlest one record. else " not presnet" when the above quesry returns 0 records i just one one sql quesry and not a Pl/SQL code.I am using oracle 9 db. ...