Testing Fields With Multiple Paths?

Jan 18, 2007

My task is to test a field in a certain database. We shall refer to the field as ship_to. There is an algorithm for which the field ship_to is populated and higher up in the algorithm, a variable we shall call X is created. The algorith states that I should assign the variable to ship_to unless X is = -1. If X is = -1, the algorithm continues with multiple joins and assignments. What would be the best way to go about coding this solution. There are 4 individual paths. I have only described the first path, but they are similiar in structure. I was thinking of using either Case's or decodes?The field ship_to is a number. I have already created a statement to test the sum of the Target, but now I need to test the entire algorithm to see if it too sums the Target.

View 1 Replies


ADVERTISEMENT

SQL & PL/SQL :: Use Distinct For Multiple Fields?

Oct 18, 2011

i have a query in this way

select field1,field2,field3 from Table1
union
select field1,field2,field3 from table2

In the query from table2 i am getting duplicate rows, HOW can i retrieve only distinct rows...Using distinct keyword did not work...if i have to post create and insert statements for this one...

View 3 Replies View Related

Select Fields From Across Multiple Tables?

Mar 25, 2011

I have had a google around and can't seem to find an answer as to how do do the following Select statement. i am wanting to Select the following fields from across multiple tables.

(field.table)
CustName.CUST
SalesNo.SALE
SalesDate.SALE
ItemDes.ITEM
Qty.SALEITEM
OrderComplete.SALEITEM

with 2 types of WHERE criteria:
WHERE SalesDate is between 'dateX' AND 'dateY'
and also WHERE OrderComplete = 'Y'

i understand this will require some sort of join in the statement so the keys for the different tables are as follows:

CUST
CustNo - PK

SALE
SalesNo - PK
CustNo - fk

ITEM
ItemNo - PK

SALEITEM
SalesNo -fk
ItemNo - fk (compound PK)

i have had a play around with using some joins & embedded statements

View 4 Replies View Related

SQL & PL/SQL :: UPDATE Multiple Fields Without Where Exist

Jun 17, 2011

I'm updating a big table with an other one (see topic

[URL]........

I was wondering if I could do it without using the WHERE EXISTS condition. Let me explain better:

create table TEST
(
ENT_SIG VARCHAR2(10),
EMP_ID VARCHAR2(10),
DATE_START DATE,
DATE_END DATE
);

create table TEST2
(
ENT_SIG VARCHAR2(10),
EMP_ID VARCHAR2(10),
DATE_START DATE,
DATE_END DATE
);

insert into TEST (ENT_SIG, EMP_ID, DATE_START, DATE_END)
values ('014', '120', TO_DATE('20080101','YYYYMMDD'), TO_DATE('20080131','YYYYMMDD'));
insert into TEST (ENT_SIG, EMP_ID, DATE_START, DATE_END)
values ('014', '121', TO_DATE('20080201','YYYYMMDD'), TO_DATE('20080228','YYYYMMDD'));
[code].....

I'm asking if there's a way to do this:

update test a
set (date_Start, date_end) = (select date_start, date_end
from test2 b
where b.emp_id = a.emp_id
[code].......

Without using the WHERE EXISTS. I don't want to make two accesses to table2, I would like instead to do something like "If subquery returns a row, use it, else keep what you have in destination table".

Is there a way to do it without entering test2 twice?

View 10 Replies View Related

Database Design - Multiple Irrelevant Fields

May 15, 2009

I am designing a database as a practice exercise, but have come across a problem.

Here is my design:

Branch Manager Employee
------- ---------- ----------
BranchID ---- ManagerID |---- EmpoyeeID
... | EmployeeID ---- ...
Manager ---- EmployeeIDOfManager
...
Branch

Note: The ... in the tables are just placements symbolizing that there are multiple irrelevant (to this thread) fields.

The problem is with the field highlighted in italics whilst the primary keys are in bold. I need to somehow retrieve that ID, but I can't create a many-to-many relationship.

View 14 Replies View Related

SQL & PL/SQL :: Get All Possible Paths?

Nov 4, 2012

Suppose I have 4 Inputs 'A','B','C' and 'D'.

Problem is I have to get all the path from
1st 'A''B''C''D' to 'A'
2nd 'A''B''C''D' to 'B'
3rd 'A''B''C''D' to 'C'
4th 'A''B''C''D' to 'D'

For 1st one all the possible paths will be:

ABCD --> ABC --> AB --> A
ABCD --> ABC --> AC --> A
ABCD --> ABD --> AB --> A
ABCD --> ABD --> AD --> A
ABCD --> ACD --> AC --> A
ABCD --> ACD --> AD --> A
... same approach for second path and so on...

The inputs may vary in number, like they may be 'A','B','C','D','E'... so on.

Note: This may not seems to be a Oracle problem, but I have to do it in Oracle as my further steps will depend on this.

View 5 Replies View Related

RAC & Failsafe :: Changing Disk Paths In ASM

Jul 13, 2012

We are about to undertake a storage migration of our RAC environment from EMC to XIV storage.

The migration method we are using means that we will be presented with identical disks post the migration, however the UNIX paths to the disk devices will be changing. Using our migration method it is not possible to present the old and new devices at the same time.

Therefore once the migration is complete i need to update the device configuration to reflect the new paths. I believe this is done using the following techniques but I am unsure as some of the documentation is ambiguous and I have not done this before

Changing path to Voting Disks

crsctl add css votedisk <new_path_to_disk> -force
crsctl delete css votedisk <old_path_to_disk> -force

Changing path to OCR Disks

ocrconfig repair ocr <new_path_to_ocr>
ocrconfig repair ocrmirror <new_path_to_ocrmirror>

Changing paths to ASM disks

alter system set asm_diskstring='<new_device_path>' scope=both;

View 3 Replies View Related

DB Query Load Testing?

Apr 12, 2013

10.2.0.5 on Solaris 10.

We need to do load testing on our DB before going live. Mainly with 5 queries which are mainly used in our web interface to pull data from the database. For example. I need to send morethan 400-500 sessions to our database using this 5 queries (with different values) and to note down the time taken with every 50 number of users..

View 2 Replies View Related

Query Testing For Null Value In IN

Nov 1, 2013

Oracle 10.2.0.4 I belive the following query is incorrect in my opinion. (there is an index on col but NULLS are ignored? 

SELECT COUNT(*) from <TABLE>

where col in (null,'a','b','c') this works (no errors) and returns pretty quick. However I think the correct query would be SELECT COUNT(*) from <TABLE> where col IS NULL OR col in ('a','b','c') This one takes a long time. As I see it it does a table scan for NULL part and uses the index for the rest as the index cannot be used for NULL values. explanation on this, especially why Oracle accepts the first query "where col in (null,'a','b','c')" without any issue. 

View 3 Replies View Related

Testing 9i On Virtual Machine Under RHEL 4.8

Sep 1, 2010

I work as a Sys. Admin. for several RHEL 3.8 servers, most of them are clusters of 2 machines. All these servers are running Oracle 9.2.0.7 database. They are running fine on a separate filesystem. So everytime the system has to be formatted for some particular reason, there is no need to re-install the database.

I am trying to make some tests by running the same filesystem containing the oracle database in a fresh Red Hat Enterprise Linux 4.8 X86_64 Install. This task has become impossible, and I'm not quite sure why.

I installed all the compat- packages required for a fresh oracle 9 install in a RHEL4 machine, but at the time of stating the STARTUP sentence, it gives me the next error:

CMCLI ERROR: OpenCommPort: connect failed with error 2.
CMCLI ERROR: OpenCommPort: connect failed with error 2.
CMCLI ERROR: OpenCommPort: connect failed with error 2.
CMCLI ERROR: OpenCommPort: connect failed with error 2.
CMCLI ERROR: OpenCommPort: connect failed with error 2.

After this error (repeated) it says something like: Cannot start an already running database.... But if i stat a shutdown sentence, it says that the instance has not been initialized....

I don't know whether i have to re-install all the oracle software in order to make a clean install in the new kernel version or not, i tried to apply a patch, and the oracle installer recognized the installation i had.

I think it might be because the original system is configured to work as a cluster, and i'm running it on only a virtual machine.

View 6 Replies View Related

SQL & PL/SQL :: Add A Not Null Constraint On A Collection For Testing?

Nov 19, 2010

I am trying to add a not null constraint on a collection for testing. It not allowed null values as below

pointers@ORCL> declare
2 type test_type is table of number not null;
3 t_test test_type;
4 begin
5 t_test := test_type(2,4,null); --null is being added
6 dbms_output.put_line('Type variable is initialized and the first element value is '||t_test(1));

[code]....

But what I observed is, i can add, null elements by using 'EXTEND' routine though 'not null' constraint is used for that type.

The below is the example.

pointers@ORCL> ed
Wrote file afiedt.buf
1 declare
2 type test_type is table of number not null;
3 t_test test_type;
4 begin
5 t_test := test_type(2,4);

[code]....

View 6 Replies View Related

Unable To Open Physical Database For Testing?

Jun 13, 2011

I have problems in opening the database of the physical standby in read- write mode/ read only mode. I have a primary server which is running on 2 node RAC and the standby on a seperate single server being used as DR. I recently got this server and my aim was to isolate the standby server from primary server and perform few test. As it has never been tested even once.

Primary Database spec: (2 Node Rac on ASM)
Oracle Version : 10.2.0.3.0
O/s : HP-UX B.11.23

Standby Database spec: (Single Node)
Oracle Version : 10.2.0.3.0
O/s: HP-UX db01 B.11.23

Error:

--------------------------------------------------------------------------------

alter database recover managed standby database cancel;

Database altered.

SQL> alter database open
2 ;
alter database open
*
ERROR at line 1:
ORA-16004: backup database requires recovery
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+DATA/dprod/datafile/system01.dbf'

--------------------------------------------------------------------------------

Parameters :

log_archive_dest_2 string SERVICE=PROD1 LGWR ASYNC VALID
_FOR=(ONLINE_LOGFILES,PRIMARY_
ROLE) DB_UNIQUE_NAME=PROD
remote_archive_enable string true
fal_client string DPROD
fal_server string PROD1, PROD2

Steps tried so far:
Changed log_archive_dest_2 = DEFER on both the primary nodes

Standby :

startup nomount
alter database mount standby database;
alter database recover managed standby database disconnect;
alter database recover managed standby database cancel;
alter database open/readonly (tried both)
Same error.

On Primary:
SQL> select max(sequence#) from v$log_history;

MAX(SEQUENCE#)

--------------------------------------------------------------------------------
55702

on Standby:

MAX(SEQUENCE#)

--------------------------------------------------------------------------------
33289

Primary Database:

SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# FIRST_TIME NEXT_TIME

--------------------------------------------------------------------------------

55700 13-JUN-11 13-JUN-11
55700 13-JUN-11 13-JUN-11
55701 13-JUN-11 13-JUN-11
55701 13-JUN-11 13-JUN-11
55702 13-JUN-11 13-JUN-11

60824 rows selected.

Standby Database:

SEQUENCE# FIRST_TIME NEXT_TIME

--------------------------------------------------------------------------------

55698 13-JUN-11 13-JUN-11
55699 13-JUN-11 13-JUN-11
55700 13-JUN-11 13-JUN-11
55701 13-JUN-11 13-JUN-11

15206 rows selected.

Additional Information : There is a delay of 20 minutes before the logs get applied. which has been intentional set by team. Dataguard broker is not configured as well.

View 7 Replies View Related

Workflow :: Run Procedure Manually For Testing Purpose

Oct 23, 2012

i want to run this procedure manually for testing purpose

procedure Reject_Doc(itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out NOCOPY varchar2 )

what are the possible values for the variables itemtype,itemkey, actid,funcmode?

View 3 Replies View Related

SQL & PL/SQL :: Testing Nested Blocks But Logic Is Apparently Not Correct?

Apr 9, 2013

I am testing nested blocks, but my logic is apparently not correct.

I am running this script:

DECLARE
v_one number(1) := 1;
v_two number(1) := 2;

[Code]....

I receive the output from only one of the nested blocks:

bad
PL/SQL procedure successfully completed.

SQL>

I understand that I don't need nested blocks for the example above, but this was just a condensed version of what I'm trying to do. I think nesting blocks will be easier to read and maintain, instead of having a huge CASE statement.

How can I execute only the nested block for which the condition is true and ignore the nested blocks that follow?

Are nested blocks not the correct answer here? Should I be looking at invoking procedures/functions instead?

View 8 Replies View Related

Clone Testing Database From X86 To X64 Using DBCA Clonic Templates

Sep 14, 2012

I'm using Oracle Database 11g R2 for study purposes.Currently I'm learning about the DBCA clonic templates.I have an Oracle DB 11g R2 X86 running properly in Ms Windows XP Professional SP 3 X86, using DBCA I created the seed template file .dbc and the .CTL and .DBF files, later I copied those files to a server running Oracle DB 11g R2 X86 in Ms Windows 7 Ultimate X86. Again, using DBCA I successfully created the source database through the seed template file, everything was ok.

Now, I formatted my testing server and I installed Ms Windows 7 Ultimate X64 and Oracle Database 11g R2 X64. I copied the seed template file .dbc and the .CTL and .DBF files to "assistantsdbca emplates" directory. Well, I started DBCA to try create the source database and when the DBCA is creating and starting the Oracle instance it shows the errors:

ORA-00604: error occurred at recursive SQL Level 1
ORA-06553: PLS-801: Internal error [56327]

Is it possible to clone my testing DB from X86 to X64 using DBCA clonic templates?

View 8 Replies View Related

Networking And Gateways :: Testing Private Database Link With Same Name As Public

Oct 13, 2010

We are currently replacing all public database links with private db links in our prod environment. The requirement is

1) private db link name should be same as public
2) Need to create and test out private db links before we can drop public db links.

How can we test out private db links while public db links are still there with the same name?

when I execute SELECT * FROM DUAL@DBLINK from user who created this private db link, which db link it will be using- public or private?

View 9 Replies View Related

Performance Tuning :: How To Clear Cache For Testing Tuned Code

Jul 4, 2011

i am testing a proc after tuning it but the problem is, it is taking a very very less time which it shouldn't. I know that it is because of the buffer cache and the shared pool. that why i need to clean the cache to retest it.

I cannot bounce the database as other schemas are part of it. so is there any way to clean the cache for that particular schema i.e bouncing any particular schema(i know that the term is not appropriate).

View 4 Replies View Related

Client Tools :: Tools For Load Testing On Oracle - J2EE Application?

Jan 5, 2012

which are recommended Tool for load testing (for performance) on Oracle-J2EE, 3 Tier applications?

Is 'Oracle Application Test Suite' the best for such test where we can simulate numbers of users and their various actions?

Does it come with Oracle Database license or we have to buy it separately?

View 1 Replies View Related

Server Utilities :: Loading Multiple Input Files Into Multiple Tables

Jul 9, 2012

NGFID;RECTYPE;RECNAME
25;7;POLES
PARENT
CHILD;1401;9845075;2020
817;8;SUPPORT
PARENT
CHILD

Required output:-

AREA_SRNO = 1
AREA_NAME = '3rivieres.export.ngf'

File :-mauri.export.ngf

NGFID;RECTYPE;RECNAME
257;7;POLES
PARENT
CHILD;1401;9845075;2020
8174;8;SUPPORT
PARENT
CHILD

Required output:-

AREA_SRNO = 2
AREA_NAME = 'mauri.export.ngf'....etc

CREATE TABLE NGF_REC_LINK
(
AREA_SRNO NUMBER(2),
AREA_NAME VARCHAR2(40),
NGFID NUMBER(20),
TABLENAME VARCHAR2(40),
PARENT VARCHAR2(200),
[code].......

find the ctl file (ngf_test.ctl) and modify the ctl file as per my requirement.

View 6 Replies View Related

Server Administration :: Multiple Database With Multiple Instance On Same Machine?

Mar 16, 2011

can we have multiple database version running in a single machine with multiple instances provided there are enough resources.Can we do in RAC only?

View 15 Replies View Related

SQL & PL/SQL :: How To Insert Data In Multiple Bases Using Multiple Database Links

Jan 2, 2013

how to insert the data in multiple bases( Same table structure in different bases) using the multiple database links?

View 4 Replies View Related

PL/SQL :: Merge Multiple Rows Into Single Row (but Multiple Columns)

Oct 17, 2012

How to merge multiple rows into single row (but multiple columns) efficiently.

For example

IDVal IDDesc IdNum Id_Information_Type Attribute_1 Attribute_2 Attribute_3 Attribute_4 Attribute_5
23 asdc 1 Location USA NM ABQ Four Seasons 87106
23 asdc 1 Stats 2300 91.7 8.2 85432
23 asdc 1 Audit 1996 June 17 1200
65 affc 2 Location USA TX AUS Hilton 92305
65 affc 2 Stats 5510 42.7 46 9999
65 affc 2 Audit 1996 July 172 1100

where different attributes mean different thing for each Information_type. For example for Information_Type=Location

Attribute_1 means Country
Attribute_2 means State and so on.

For example for Information_Type=Stats

Attribute_1 means Population
Attribute_2 means American Ethnicity percentage and so on.

I want to create a view that shows like below:

IDVal IDDesc IDNum Country State City Hotel ZipCode Population American% Other% Area Audit Year AuditMonth Audit Type AuditTime
23 asdc 1 USA NM ABQ FourSeasons 87106 2300 91.7 46 85432 1996 June 17 1200
65 affc 2 USA TX AUS Hilton 92305 5510 42.7 46 9999 1996 July 172 1100

View 1 Replies View Related

SQL & PL/SQL :: Multiple Rows On A Table To Multiple Columns On One Row

Nov 26, 2010

I am attempting to select back multiple values for a specific key on one row. See the example below. I have been able to use the sys_connect_by_path to combine the fields into one field but I am unable to assign them to fields of their own. See the example below

TABLE DETAILS:
Policy id plan name
111 A Plan
111 B Plan
111 Z Plan
112 A Plan
112 Z Plan

My desired result is to be able to show the output as follows

Policy ID Plan_1 Plan_2 Plan_3
111 A Plan B Plan Z PLan
112 A Plan Z PLan

View 6 Replies View Related

10g - Some VARCHAR2 Fields Empty?

Jul 21, 2011

Once a year in the application we have a specific query that gets used a lot. It's an UPDATE that updates a single record in a single table with a few different datatypes, but the issue is happening with one of the VARCHAR2 fields. It updates one VARCHAR2(2000) and three VARCHAR2(4000) fields at the same time.

This year, 9 of the 95 times it was used resulted in one of the VARCHAR2(4000) fields as null in the database. The users would not want this field to be null and 5 of the 9 have told us they entered something (the form they're filling out is a research proposal and leaving this field empty would be pointless because it's part of the funding request, so they're not doing it). The application isn't doing it because it's not consistent. I've checked the application and these fields can't be nulled any other way.

We just found the issue so I looked back over the past years back to 2005. Last year it didn't happen at all. In 2010 it happened a handful of times. Some years there were even more times. It's not always the same field but it's always a VARCHAR2 of at least 2000 characters.

I have a lot more information but it's all just details (let me know if you need to know more). I'm wondering if there is a bug in 10g with these types of fields. I don't believe it's malicious behavior on an individual's part but I suppose that's always possible.

how to research something like this. I tried to get access to Oracle Support and the Knowledge Base I heard they have but it doesn't look like I can do that

View 2 Replies View Related

Concatenation Of Fields For Output

Mar 15, 2007

I have the following fields:

Addressln1
Addressln2
Suburb
Town

I know how to concatenate them

trim(Addressln1) || ',' || trim(Addressln2) || ',' || trim(Suburb) || ',' || trim(Town) as Address

1. I would like to know if any of the fields are empty I would like to eliminate the comma character from the string.
2. Can I replace the comma with a new line character and what character to be used in the syntax.

View 2 Replies View Related

Loader - Not Getting Data In Some Of Fields?

Feb 7, 2012

We are using Oracle 10g, on redhat linux (version not known to me).I'm running a Perl script that reads in data from Visual FoxPro tables, creates datafiles on the fly from these FP tables, then SQL-Loader runs and uploads all the data to matching tables in Oracle.

Problem:My upload runs, but I'm not getting the data in some of the fields that I should be. It is being uploaded to the wrong fields.

I had to add more columns to the Oracle tables in order to capture the data coming from FoxPro. These columns were/are in FoxPro. In the past, they were not needed in Oracle. I was using the FILLER command in the Control files to skip these. Now they are needed in Oracle. The new columns get added to the end of the table in Oracle, so they are not in the same exact order they are in FoxPro. It is these new columns that are not getting the correct data.

I've learned in the past that I need the fields/columns in the control files to match the order they are in the FoxPro tables from which the data comes. My Question is, Does the Oracle table column order have to match the Control file column order. Like so: FoxPro table column order = control file column order = Oracle table column order

View 1 Replies View Related

SQL & PL/SQL :: Get Value From One Column But Display ID Different Fields

Oct 22, 2012

get members's home and work and cell phone number if it's avaiable. if not just disply null.

Table name : Test

member entity_id Phone_id phone_code Phone_num
abc 400175 200201 HME 49.6171.59501
abc 400175 200202 CEL 491.170.9174054
abc 400175 200203 WRK 49.6142.7.76675
def 521985 199991 HME 555-555-5555
ghi 345634 188881 HME 222-345-2345
ghi 345634 188882 CEL 222-456-6565

[Code]...

View 6 Replies View Related

SQL & PL/SQL :: Concatenating Address Fields

Oct 28, 2013

The pipe separator needs to appear only when values found in addr1 or addr2 or addr3.

WITH address AS (SELECT 'Silver Arc Plaza,' addr1,'4th Floor, 20/1, New Palasia' addr2,'Indore' addr3 FROM dual UNION ALL
SELECT 'Shop No. 1,Vishnu Priya Building,' addr1,'' addr2,'pune' addr3 FROM dual UNION ALL
SELECT 'D/7, Siddhivinayak Nagari,' addr1,'Nr. Majura Gate, Ghod dod Road,' addr2,'' addr3 FROM dual UNION ALL
SELECT '' addr1,'B 4, Gold Coin Complex,' addr2,'Ahmedabad' addr3 FROM dual UNION ALL
SELECT '' addr1,'' addr2,'' addr3 FROM dual)
select addr1||'|'||addr2||'|'||addr3 address from address;

View 18 Replies View Related

SQL & PL/SQL :: Find From And To Date Between Two Fields

Aug 2, 2010

I have oracle table for Leave

LeaveNo - FromDt - ToDt - Query Retrieve
1 - 01/01/2010 - 31/03/2010 - No
2 - 01/02/2010 - 31/05/2010 - Yes
3 - 01/04/2010 - 30/04/2010 - Yes
4 - 25/04/2010 - 15/05/2010 - Yes
5 - 01/05/2010 - 31/05/2010 - No
6 - 15/03/2010 - 14/04/2010 - Yes
7 - 10/04/2010 - 15/04/2010 - Yes

I want find out who was leave on 01/04/2010 to 30/04/2010. user input parameter may vary like 10/04/2010 to 15/04/2010 or 12/04/2010 to 12/04/2010.

how to write oracle sql?

View 12 Replies View Related

SQL & PL/SQL :: Calculate With Calculated Fields?

Feb 24, 2010

can I use calculated fields (b) for another calculation (c) in the same select?

select 10*a as b,
10*b as c
from tab

The code gives an error, but how can I do this?

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved