The biggest problem at the moment I have is that I don't know how to go trough all record set having to read it in only once. And other is my calculations doesn't work and im not really sure why.
I am fairly new to Oracle SQL developer and I am having an issue that may very simple but I just cannot work it out logically for some reason.I am trying to calculate the percentage of sales each employee has made form the total of trades. I have been trying to use the COUNT function but it obviously splits the counts for each employee. I then tried a inline view but couldn't get it to work and also a sub-query and had an issue with "not a single group function" and then "not a GROUP BY expression".
how I can do this? I will also need to add the syntax to another inline view
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?
Version of the database you are using: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production Version of Application Express: 4.1.1.00.23
I have a requirement that is driving me stark raving bonkers.
I have a form that a user fills out, it sets the Status to 'Open' and I capture the Date Created On in a hidden field. When someone goes back in to the Form and sets the Status to 'Closed' I capture the Date Closed On in a hidden field. I need to calculate how many hours that it took to close the issue and display it on the form.
I am running APEX 4.0.2.I am having an issue where I have a page item that has a post calculation
My source used is "Always..." My source type is "Database Column"
I have tried putting the code in the page item under "Post Calculation Computation", as a dynamic action, and as a Computation Process. It displays properly on the form no matter where I put the code, but when I select Apply Changes it is not updating the database. What am I doing wrong? I have provided a sample of the code, and yes the column name is in the database.
CASE WHEN :P12_NUM_OF_BOOKED_DEALS>0 AND :P12_DATE_1ST_COMPLETE IS NULL THEN '(2) In Process' ELSE '(D1) Open Draft' END
I am using oracle forms10g here i have next button. So when i click the next button it will show the total volumn of record count and each record value for example 1/10 like that.
I am loading data file using SQL Loader in TOAD 10.5.1.3 in Oracle 10g using the control file below and loading data into 2 tables post1.thead and post1.tdetl. THEAD contains item level transaction and TDETL is detail level when a transaction has a discount or promo attached to for that item. When the
LOAD DATA APPEND INTO TABLE post1.thead WHEN (1:5) = 'THEAD' TRAILING NULLCOLS (file_type POSITION(1:5)CHAR,
[code]....
A particular THEAD value may have 0, 1 or many TDETL corresponding values.below is a sample data file. When the position 21 in the TTAIL has a value of 1 or 2, then we know that there is a promo or discount applicable to the ITEM (THEAD).
What I want to acheive is to accurately reflect a TDETL to its corresponding THEAD, as both THEAD and TDETL are loaded into separate tables. How can we have the 2 records correlated?
I have a table which contains the multiple records for single ID No. Now i have to select single record which contains the latest date. here is the structure Name
Null Type ------ ---- ------------ ID_P NUMBER NAME_P VARCHAR2(12) DATE_P TIMESTAMP(6) Records---------------------1 loosi 22-AUG-13 01.27.48.000000000 PM1 nammi 26-AUG-13 01.28.10.000000000 PM2 kk 22-AUG-13 01.28.26.000000000 PM2 thej 26-AUG-13 01.28.42.000000000 PM
now i have to select below 2 rows how can write select qurie for this?
I have a fairly standard Purchase Order form which contains pre-loaded data (been uploaded from an XML file).When the Purchase Order is processed, the form updates a Price History table only if the Price on the PO_Details changes.The code for updating the price history table is contained in a PRE_UPDATE trigger on the PO_Details Data Block.
No other data changes on the PO_Details table.I now want to change this so that the Price History table is updated even if the price does not change i.e I want to create a history record for each record on the PO_Details irrespective of whether it was updated or not.
Is there an alternative trigger that I can move my code to (ie move it from PRE_UPDATE) to some other trigger that is fired for each PO_Details record even if there is no change.
I need to create a query that returns record by record a field qty_progr with the cumulate qty considering previous records. The result should be the following:
1.display_item (primary key) 2-list_item (foreign key) / / dynamic list :this is the cause of the error 3-lis_item (foreign key) / / dynamic list 4-text_item 5-button (insert commit)
when I click the button, an error is displayed:
FRM-40508: ORACLE error: unable to INSERT record.in detail: ora-02291 integrity constraint Violated - parent key not found
Note:
-the elements of two lists already exist in the parent table!!
I have the search screen in my form so after searching if i select the row by using the button it will navigate the first tab page that is "gas" screen here if i tried to change the value like update and save the form it is not allowing me to update the value raising the error message "oracle unable to insert the record". if i see the "display error" in menu it is having the select statement with error "unique key violation error ora-00001".
I want to print two record of emp table in same line number in tabular format report.
For example if i have emp table and I want to print empno,ename,sal columm only,In tabular format report, Two record should print per line. so If emp table have 14 record report should be printed on 7 rows.
so the output in print preview should be like this
EMPNO ENAME SAL EMPNO ENAME SAL ------ ---------- ---------------------------------------------- 7369 SMITH 800 7499 ALLEN 1600 7521 WARD 1250 7566 JONES 2975 7654 MARTIN 1250 7698 BLAKE 2850 . . . .
We are going to upgrade our Oracle client on our clients to 11.2.0.3. But I can not record a resopnsfile with setup.exe. Have Oracle removed this feature?
Here's a dump from setup.exe
There is no possibility to run setup.exe witch -record -destinationfile option:
Preparing to launch Oracle Universal Installer from C:UsersTestAppDataLocal TempOraInstall2013-01-14_02-12-48PM. Please wait ... Usage: setup [-options] [(<CommandLineVariable=Value>)*]
Where options include:
-clusterware oracle.crs,<crs version>
Version of Cluster ready services installed.
-crsLocation <Path>
Used only for cluster installs, specifies the path to the crs home locat ion. Specifying this overrides CRS information obtained from central inventory.
-invPtrLoc <full path of oraInst.loc>
Unix only. To point to a different inventory location. The orainst.loc f ile contains: inventory_loc=<location of central inventory> inst_group=<>
-jreLoc <location>
Path where Java Runtime Environment is installed. OUI cannot be run with out it.
-logLevel <level>
To filter log messages that have a lesser priority level than <level>. V alid options are: severe, warning, info, config, fine, finer, finest, basic, gen eral, detailed, trace. The use of basic, general, detailed, trace is deprecated.
-paramFile <location of file>
Specify location of oraparam.ini file to be used by OUI.
-responseFile <Path>
Specifies the response file and path to use.
-attachHome
For attaching homes to the OUI inventory.
-cfs
Indicates that the Oracle home specified is on cluster file system (shared). This is mandatory when '-local' is specified so that Oracle Universal Installer can register the home appropriately into the inventory.
[code]....
Session/Installer variables are specified using:
[session:]varName=value Ex 1: session:ORACLE_HOME_NAME="OraHome" Ex 2: ORACLE_HOME_NAME="OraHome" The lookup order is session:varName then just varName. The session prefix is used to avoid ambiguity.
Component variables are specified using:
[compInternalName:[Version:]]varName Ex 1: oracle.comp1:1.0.1:varName="VarValue" Ex 2: oracle.comp1:varName="VarValue" The lookup order is compInternalName:Version:varName, then compInternalName: varName, then just varName.
I have an application connected to Oracle 11g that sends its own querys to the db based on what the user is clickng on. The applicaiton is connected via one user id and I was wondering, is there a way that I can capture the tiem each query starts, the sql itself, and the amount of time it took to fetch the data?
Using 11gR2, windows 7 client machine. I need to update the table missing_volume (below), where I need to calculate the estimated_missing column. The calculation of estimated_missing column for current month needs previous month numbers (as commented inside the code below). I want the output like the first table. Notice the records start from January, hence estimated_missing for January can't be calculated, but for the the rest of the months it can be done by simply changing 'yr' and 'mnth' (commented inside the code towards the end).
yr mnth location volume actual_missing expected_missing estimated_missing --------------------------------------------------------------------------------------------------------------------------------- 2013 January loc1 48037 24 57 2013 February loc1 47960 3660 53 24 2013 March loc1 55007 78 57 28 2013 April loc1 54345 72 58 77The code:
UPDATE missing_volume g
[Code]....
The code does calculate correct number for 'estimated_missing' as I run the code for each month, but the problem is while updating the current month it also erases the record for previous month. E.g. as can be seen below, after I updated April the column only has the record for April, previous month record is gone, similarly updating March removed February, etc. I can't understand why it's happening!! Here is the output I get:
yr mnth location volume actual_missing expected_missing estimated_missing --------------------------------------------------------------------------------------------------------------------------------- 2013 January loc1 48037 24 57 2013 February loc1 47960 3660 53 2013 March loc1 55007 78 57 2013 April loc1 54345 72 58 77
why it's happening (I mean where is the flaw in the code) and how to get the desired output (first table).
I have a date column in a table, I need to fetch records from 27:11:11 00:00:10 to 30:11:11 00:00:10 (DD:MM:YY HH:MI:SS). i.e between seconds/min/hrs.
expecting Something like this,
SELECT * FROM TABLENAME WHERE MODEDATE BETWEEN TO_CHAR('27/11/11 00:00:10','DD-MN-YY HH24:MI:SS') AND TO_CHAR('30/11/11 01:10:10','DD-MN-YY HH24:MI:SS')
I have a cursor which I am opening and then looping through. Within this loop I am comparing attributes within this cursor with attributes from another loop that this one is within.
you will see in the IF statements (there are several distinct IF statements within the loop) that there is a check which assesses if the attributes are not equal.
If they are NOT, the value of v_mismatch is set to 1
What I need to do instead of setting this to 1, is to go to the next record in the loop. How can I achieve this?
OPEN c_distMatrix; LOOP FETCH c_distMatrix INTO r_dist; EXIT WHEN c_distMatrix%NOTFOUND; --compare each field and update the counter [code].....
Based on ACCOUNT_NUMBER column we have to check the GUID data in test table.
for example ACCOUNT_NUMBER =11 as duplicate it has 2 values then only, we need to check the corresponding GUID if any occurence ("9f680174-cb87-4f71-887a-92" and "9f680174-cb87-4f71-887a-91"), we should select,if not leave it.
I need select last added/inserted records where value = 'test1' and = 'test2' and = 'test3' in column 'NAME' should be one record for each 'test1','test2' ...
aslo..table have column 'DATE_USR' with data_type = timestamp(6)
in my loop with cursor in a procedure body i am displaying some field values to create a report and after every record i am displaying horizontal line(-------) but i don t want this line to appear after the last record displayed like below,
restricting a subquery's results to the first record. If I use the following:
SELECT WU.DISCREP, M.PART, M.ETA FROM DB.MICAP M LEFT JOIN DB.WRITEUPS WU ON M.WRITEUPID=WU.WRITEUPID LEFT JOIN DB.WUC WUC ON WU.WUCID=WUC.WUCID WHERE (WU.AIRCRAFTID=205) AND (WU.CORRECTED=0) ORDER BY WU.PACER DESC, WUC.WUCCODE
But I need the highlighted line eliminated. I've tried DISTINCT subqueries in the WHERE M.WRITEUPID IN (SELECT DISTINCT... various experiments with joins, etc.