I'm getting back more than I want. I need to get the latest row in the PS_ACAD_STDNG_ACTN that has the academic standing code for students.
I thought if I max the effdt, strm, and effseq I would get back only one row. Especially effdt since a academic status is hardly ever updated on the same date.
PS_NTSR_GF_STUFILE will have multiple emplid's for students taking classes. PS_ACAD_STDNG_ACTN should have the last standing status for each student..(PRO = Probation, DIS = Dismissed).
UPDATE PS_NTSR_GF_STUFILE a SET a.NTSR_GF_ENRL_STAT = nvl(( SELECT b.GBSA_SUB1 FROM PS_GBSA_DTL b, PS_ACAD_STDNG_ACTN c WHERE c.ACAD_STNDNG_STAT = b.GBSA_VALUE
This is a surprisingly common one I've found on the web...even on devshed forum
I am updating one table from another (Updating Table A from Table B):
Table A ID, Value -- ----- 1 A 1 A 2 B
Table B ID, Value -- ----- 1 Animal 2 Box
Table A (modified) ID, Value, Name 1 A Animal 1 A Animal 2 B Box
No I need to update a new column in Table A with the value in Table B.Value where the ID's from both tables match. Problem is: When I do this I get multiple rows and hence Oracle won't let me update this column. Now, I keep reading that for these types of updates, there has to be a one-to-one relationship...
Is this true...is there anyway of telling Oracle to update wherever it finds that ID, regardless of how many duplicate ID's there are?
This is quite a frustrating problem and most of the sites that I've looked for solutions try get the query one-to-one...problem is...with my table sets it's impossible to do that - I need to update wherever the id's match (even if it return multiple rows).
I have two update queries in the same Proc. One Seems to run just fine, the other I am getting this error:
ORA-01427: single-row subquery returns more than one row
The working Updates' structure is the same as the erroneous one. This works:
UPDATE P0525_STOREROOM_HOLDER H SET H.STRATIFICATION_ID = (SELECT X.STRATIFICATION_ID FROM EMISTRATIFICATION_XS X WHERE H.TOA = X.TOA AND H.STOREROOM = X.STOREROOM AND H.NSN = X.NSN AND X.ASSEMBLY = 'NO REQUIREMENT' );
This one gives me a single-row error:
UPDATE P0525_STOREROOM_HOLDER H SET H.STRATIFICATION_ID = (SELECT X.STRATIFICATION_ID FROM EMISTRATIFICATION_XS X WHERE H.TOA = X.TOA AND H.STOREROOM = X.STOREROOM AND H.NSN = X.NSN AND X.ASSEMBLY = 'ABOVE ALLOWANCE' AND H.NSN_QUANTITY > 0);
I have run a check on the data and there doesn't appear to be any duplicate values in the second update... Both Updates are supposed to be updating record sets not a single row (i.e. the stratification_id where the criteria matches...
i am trying to export table using datapump in oracle 10g, this expdp takes 5 hours time, so i want use use parallel keyword in expdp, my question is how should i know number of parallels can i use...?
grant select(employee_id, job_id) on employees to scott;
But it returns error as
HR:orcl > grant select(employee_id, job_id) on employees to classuser; select(employee_id, job_id) on employees to classuser * ERROR at line 1: ORA-00969: missing ON keyword
I am having some difficulties with this trigger. It keeps giving me the error "ERROR at line 5: PL/SQL: ORA-00923: FROM keyword not found where expected" when I am not even using a SELECT before the line it says the error is on? Here is the trigger that I am attempting to create.
CREATE OR REPLACE TRIGGER ClassRestraint BEFORE INSERT ON Enrolled FOR EACH ROW DECLARE numCourses NUMBER :=0; myException EXCEPTION; BEGIN [code]...
I have this script which should find tablespaces and their size, joined with free bytes. Trying to run this gives me the SQL Error: ORA-00923: FROM keyword not found where expected.
I have two questions:
1. Where should the FROM be?
2. Is there something wrong with the join.
============================================== set linesize 120 col "TOTAL (KB)" format 99999999999999999 col "FREE (KB)" format 9999999999999999 col TSNAME format a35 col "% FREE" format a10;
SELECT a.tablespace_name TSNAME, sum(a.bytes/1024) "TOTAL (KB)", Sum(b.bytes/1024) "FREE (KB)" To_char(round((sum(a.bytes/1024)/sum(a.bytes/1024))*100),2), 'FM99990D999999') || ' % ' "% FREE" FROM dba_data_files a, dba_free_space b Where a.tablespace_name = b.tablespacename Group by a. tablespace_name [/i] =============================================
I used the script from [URL]
It worked great but I'm not sure how to use the arithmetic functions to show me MB instead of bytes.
I am trying to compile this block for updating a record. In the P_ADD_LOV_SQL column, I have to update the following select statment, but when ever I am compiling it it shows error in the Select statement as : ORA-00923: FROM keyword not found where expected. rearrange the select statement so that it doesn't show the error.The coding is :
I just so happen to be the one trail blazing the pivot function for the section of the company I work in. (Needless to say, a Sesame Street style answer will not be offensive.) We are literally in the process of upgrading to 11g (11.2.0.1.0). Sadly, none of our more experienced programmers now anything about the pivot function. Not really surprising to me since we've been working in 10g. Anyway, I am using SQL Developer version 3.0.04 which I know is not the newest but I don't yet have permission to upgrade. I used [URL] to get me as far as I am on this function.
The script I am having problems with is:
SELECT * FROM (SELECT
[Code]....
The error I'm getting is:
ORA-01738: missing IN keyword 01738. 00000 - "missing IN keyword" *Cause: *Action: Error at Line: 16 Column: 2
The error indication bounces between line 15 and 16. If I put IN at the end of 15 I then have a missing right parenthesis error...
This code run fine in Toad BUT giving me error in forms.
SELECT LEVEL LOC_NAME, LOCATION_NAME LOC_ID, LOCATION_ID HLOC_ID, HEAD_LOC_ID MUDRA FROM AS_LOCATION_HDR CONNECT BY PRIOR LOCATION_ID = HEAD_LOC_ID START WITH HEAD_LOC_ID is null ORDER SIBLINGS BY LOC_ID
The error is: "Encountered sysbol "SIBLINGS" when expecting one of the following: by The symbol "by inserted before the "SIBLINGS" to continue.
Is the SIBLINGS keyword not acepted in forms? What would be the alternative?
We have an Oracle UCM and Oracle SES implementation.Currently there are too many tags returned for certain keywords by SES which breaks the UI,some of the tags being irrelevant too.Is there any configuration variable in SES by which these tags can be limited to say 20 most relevant tags.?
We are running on Oracle 10g. The following script results in ORA-00928: missing SELECT keyword. what causes this error? Both 'select' statements when run by themselves, complete successfully.
[code]WITH A1 AS WITH A1 AS ( SELECT MIN (VAPS_RPT_INTV_DMSN.INTV_DT), VAPS_RPT_INTV_DMSN.RPT_ID, VAPS_RPT_INTV_DMSN.RPT_INTV_ID FROM APS.VAPS_RPT_INTV_DMSN, APS.VAPS_RPT_CL_INTV_DMSN WHERE APS.VAPS_RPT_INTV_DMSN.RPT_INTV_ID =
SELECT LOCALTIMESTAMP,SYSTIMESTAMP,EXTRACT(hour FROM LOCALTIMESTAMP) +2, CASE WHEN EXTRACT(HOUR FROM LOCALTIMESTAMP) +2 Between 9 and 17 OR (EXTRACT(HOUR FROM LOCALTIMESTAMP)+2 = '5' AND EXTRACT(MINUTE FROM LOCALTIMESTAMP)+2 > '60') THEN TO_CHAR(FROM_TZ(LOCALTIMESTAMP,'GMT') AT TIME ZONE '+05:30','DD-MON-YYYY HH24:MI:SS') CASE WHEN EXTRACT(HOUR FROM LOCALTIMESTAMP)+2 < '9' THEN TO_CHAR(FROM_TZ(SYSTIMESTAMP,'GMT')+2 AT TIME ZONE '+05:30','DD-MON-YYYY HH24:MI:SS') END FROM dual;
I have one query regarding how to retrieve the CLOB data.
The requirement is something that in the select statement there are around 20+ columns which i need to retrieve from around 5 tables after joining.
Since the result set after joining also will get duplicate values i need to use distinct keyword to filter the resultset. But in the 20+ columns there are 2 CLOB data columns which i need to retrieve.
Whenever i use DISTINCT i'm getting ORA-00932: inconsistent datatypes: expected - got CLOB error. I know that DISTINCT keyword cannot be used for CLOB datatypes.
I am importing data from excel to database table with column mapping.I have created package with a procedure. I am calling this procedure from oracle forms 6i. while executing the package procedure,I am getting following error ora-00928 missing select keyword ora-06512 at" abcd.pk_ excel_ to_ db" line 26 i.e befor forms_ddl.there is no problem in code and my form gets compiled but at run time i am getting this error.I also want to check, array is populating with anything or not.
PACKAGE PK_EXCEL_TO_DB IS TYPE tKeyValue IS RECORD ( CROUTE VARCHAR2(255), VROUTE VARCHAR2(1000), CTRNDATE VARCHAR2(255), VTRNDATE VARCHAR2(1000), CTTIME VARCHAR2(255), VTTIME VARCHAR2(1000), CTID VARCHAR2(255), VTID VARCHAR2(1000)); TYPE tDataList IS TABLE OF tKeyValue index by binary_integer; [code].....
i have a table that contains employee id, employee name , so if i gave the correct employee id in where clause of select statement it will show employee name, in case if i give the employee id that does not exist in the table it will show 'Employee name is not found'..
I was reading a tutorial for analytical function and i found something like this
sum(princial) keep(dense_rank first order by d_date) over partition by (userid, alias, sec_id, flow, p_date)
How to translate this into simple queries / subquery? i am aware that analytical function are faster but i would like to know how this can translate to using query without analytical function.
I have a database containing the following after entering the following sql command
SELECT TITLES.TITLE_ID AS TITLE_ID, (PRICE * SALES), TITLES.ROYALTY_RATE AS ROYALTLY_RATE, AUTHOR_TITLES.ROYALTY_SHARE AS ROYALTY_SHARE, AUTHORS.FNAME AS FNAME, AUTHORS.LNAME AS LNAME FROM TITLES, AUTHOR_TITLES, AUTHORS WHERE TITLES.TITLE_ID = AUTHOR_TITLES.TITLE_ID AND AUTHORS.AU_ID = AUTHOR_TITLES.AU_ID
What I need to do is create a subquery and use Aggregation to list the author receiving the greatest royalties on revenue. so i used the command to get the royalties
SELECT TITLES.TITLE_ID AS TITLE_ID, (PRICE * SALES), AUTHORS.FNAME AS FNAME, AUTHORS.LNAME AS LNAME, ((PRICE * SALES) * TITLES.ROYALTY_RATE * AUTHOR_TITLES.ROYALTY_SHARE) AS ROYALTIES FROM TITLES, AUTHOR_TITLES, AUTHORS WHERE TITLES.TITLE_ID = AUTHOR_TITLES.TITLE_ID AND AUTHORS.AU_ID = AUTHOR_TITLES.AU_ID
So how do I add up the royalties values associated with each author and find the max? for example I add klee hulls's royalties from each book and get 2,123,336.32(doing it by hand on calculator) what is the sql to find the max royalties for each author? P.S the answer should be KLEE HULL with 2,123,336.32
I am returning the ORA-01427 after running the query below. why I am returning the error and how to address it.
select b.value , b.name, p.value ...... (case when p.value <> 'G2' then null else (select c.oldvalue from ad_changelog c where c.record_id = b.c_bpartner_id and c.ad_table_id = 291 and c.ad_column_id = 4216 ) end) as oldtradeName from c_bpartner b, zz_receipt r, zz_recp_alloc a, m_product p, ad_user us where a.c_bpartner_id = b.c_bpartner_id and a.zz_receipt_id = r.zz_receipt_id and us.ad_user_id = r.createdby and p.m_product_id = a.m_product_id
Just trying to update a table in which the sales amount is inserted when the sales amount is null.
I have
UPDATE ph2_customer_temp SET sales_amount = ( SELECT sl.sales_amount FROM PH2_CUSTOMER_TEMP pct join sales_limit sl on substr(pct.site_code,1,2) = sl.state where pct.credit_limit is null )
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.