Update using a select statement How to?
Greetings
I have a table of customer records that has a unique customer number.
I have another table that has multiple entries for each customer record number reflecting updates over time.
Each time a change is made a new record is inserted and a change date field is set to the current date.
I want to get the oldest change date inserted into a field in the master Customer table.
I have attempted a number of different queries. i was wondering if someone might be able to point to my failings.
This query gets the value that i want.
select BI_ACCT_CODE, min(bi_date_chng) from gen_bitaccttable group by BI_ACCT_CODE
61638538 29/JUL/04
61638547 29/MAY/04
61638556 30/JUL/04
61638565 29/OCT/11
61638574 29/JUL/05
61638583 29/JUL/89
61638592 29/JUL/05
61638609 29/JUL/06
etc.............
BI_ACCT_CODE is the customer number that exists in both tables.
This is the current state of my query.
update CDM_CUSTOMER
set CUS_REGISTRATIONDATE =( select BI_ACCT_CODE ,min(bi_date_chng) from gen_bitaccttable
group by BI_ACCT_CODE where gen_bitaccttable.BI_ACCT_CODE = CDM_CUSTOMER.CUS_SEQNO);
This complains with the following error.
Error starting at line 147 in command:
update CDM_CUSTOMER set CUS_REGISTRATIONDATE =( select BI_ACCT_CODE, min(bi_date_chng) from gen_bitaccttable group by BI_ACCT_CODE where gen_bitaccttable.BI_ACCT_CODE = CDM_CUSTOMER.CUS_SEQNO)
Error at Command Line:147 Column:118
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
Thanks
Thanks for responding.
I modified it to:
update CDM_CUSTOMER set CUS_REGISTRATIONDATE =( select min(bi_date_chng) from gen_bitaccttable group by BI_ACCT_CODE where gen_bitaccttable.BI_ACCT_CODE = CDM_CUSTOMER.CUS_SEQNO)
This still gives the error.
Error starting at line 153 in command:
update CDM_CUSTOMER set CUS_REGISTRATIONDATE =( select min(bi_date_chng) from gen_bitaccttable group by BI_ACCT_CODE where gen_bitaccttable.BI_ACCT_CODE = CDM_CUSTOMER.CUS_SEQNO)
Error at Command Line:153 Column:118
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
Similar Messages
-
How to use the select statement in for loop
Hi All,
my question is can we use select statement in for loop like as follows .
for key in select key from one_table.
when i am using this am getting an error like Found select invalid i identifier
how to make use of select statement in for loop
please suggest me .
Thanks
SreeSQL>set serveroutput on;
SQL> DECLARE
BEGIN
FOR Cur_Rec IN (SELECT dname FROM dept) LOOP
DBMS_OUTPUT.PUT_LINE(Cur_Rec.dname);
END LOOP;
END;
SQL>
ACCOUNTING
RESEARCH
SALES
OPERATIONSAs per your requirement always filter the Query beforehand
Like
FOR Cur_Rec IN (SELECT key FROM <table> WHERE key=1) LOOP
END LOOP;Edited by: Lokanath Giri on १ दिसंबर, २०११ ३:५६ अपराह्न -
How to join THREE different tables into internal table using one select statement .
How to join THREE different tables into internal table using one select statement .
Hi experts,
I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
Scenario:
Database tables:
SPFLI
SFLIGHT
SBOOK.
Table Fields:
SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
SEATSOCC_C SEATSMAX_F SEATSOCC_F
SBOOK - CARRID CONNID CLASS
MY INTERNAL TABLE IS IT_XX.
Your help much appreciated.
Thanks in advance.
Pawan.Hi Pawan,
please check below codes. hope it can help you.
TYPES: BEGIN OF ty_xx,
carrid TYPE spfli-carrid ,
connid TYPE spfli-connid ,
countryfr TYPE spfli-countryfr,
cityfrom TYPE spfli-cityfrom ,
countryto TYPE spfli-countryto,
cityto TYPE spfli-cityto ,
fldate TYPE sflight-fldate ,
seatsmax TYPE sflight-seatsmax ,
seatsocc TYPE sflight-seatsocc ,
seatsmax_b TYPE sflight-seatsmax_b,
seatsocc_b TYPE sflight-seatsocc_b,
seatsmax_f TYPE sflight-seatsmax_f,
seatsocc_f TYPE sflight-seatsocc_f,
class TYPE sbook-class,
END OF ty_xx,
t_xx TYPE STANDARD TABLE OF ty_xx.
DATA: it_xx TYPE t_xx.
SELECT spfli~carrid
spfli~connid
spfli~countryfr
spfli~cityfrom
spfli~countryto
spfli~cityto
sflight~fldate
sflight~seatsmax
sflight~seatsocc
sflight~seatsmax_b
sflight~seatsocc_b
sflight~seatsmax_f
sflight~seatsocc_f
sbook~class
INTO TABLE it_xx
FROM spfli INNER JOIN sflight
ON spfli~carrid = sflight~carrid
AND spfli~connid = sflight~connid
INNER JOIN sbook
ON spfli~carrid = sbook~carrid
AND spfli~connid = sbook~connid.
Thanks,
Yawa -
Create a view using a select statement
Hi
I need to create a view using a select statement to view details from 2 different tables which will only show data where the holidays commence after june.
I am new to oracle so any help will do.
ThanksHi
I need to create a view using a select statement to view details from 2 different tables which will only show data where the holidays commence after june.
I am new to oracle so any help will do.
Thanks -
How can i retrieve the output of procedure using a select statement ?
Hi every one.
this mite be dumm ?
how can i use the output of the a procedure containing multiple rows of data in a select statement ?This is not a SQL Developer question. You should ask it in the SQL and PL/SQL forum.
The short answer is you can't. Sounds is if you are trying to use MSSQL techniques in oracle. Learn oracle techniques -
How to get the value from a function using a select statement
I have a function(user defined not built in) that returns multiple values(like an array). My question is how do i get those values in a select statement. when i tried to retrieve it,
select pack.my_members from dual;
i am getting an error
ORA-00902: invalid datatype
I am sure this must be a syntax error with the select statement
The following is the function that give the array of data
package pack
package spec
Type my_table is table of varchar2(25);
function the_members
return pack.my_table;
pakcage body
function the_members return pack.my_table
Remarks: This function returns a table containing names of the
members
is
tm pack.my_table:= pack.my_table('first member','second member','third member','fourth member');
begin
return tm;
end the_members;Check this example on Pipelinedfunction
-
How to use a select statement with chinese characters?
I am currently developing a java servlet<using tomcat 4.x> which allows me to use select statement to retrieve results from the Microsoft SQL Server 2000 database. I am using a simple form to get the parameter for querying. The main problem i'm facing is that there are chinese information in the SQL database, but i can't retrieve it through the sql statement with the chinese characters input<thru the form with the help of NJ STAR>in the WHERE condition. When i execute the statement, it returns me no results even though the rows are present in the database.
Does anyone have the solution to using chinese words in the WHERE clause of the select statement to retrieve results with columns which contains chinese characters? Please help me. Thanks everyone. :)
PS: when i cut and paste those characters in the sql database and paste onto java.. it is ??? in questionmarks.. but when i paste them into excel 2000.. its shown as chinese chars again..
please heelppp~~Greetings,
PS: when i cut and paste those characters in thesql
database and paste onto java.. it is ??? in
questionmarks.. but when i paste them into excelThis is why the SELECT is not returning any results.
You need to set the character encoding set on your
statement and parameters for the characters to be
properly translated. Refer to the charsetName
parameter in the String class constructor in your API
docs and also to
$JDK_DOCS/guide/intl/encoding.doc.html in your JDK
documentation.
2000.. its shown as chinese chars again..Because Office programs are performing the same kind
of character translation with the appropriate MS APIs.
please heelppp~~Regards,
Tony "Vee Schade" Cookis it possible for you to show me some coding examples? i don't really understand what is to be done in order to set the char set and what does it really do.. tried reading up but still dun understand.. :(
pardon my shallow knowledge of java..
ok..
The thing is when i used an insert statement with chinese characters of GBK format hardcoded into the java servlet and then i use the insert statement to insert the chars into the database, it cannot be seen as a chinese word when i off the NJStar. and then it can be searched out with my current form of servlet.. below is my coding of the servlet..
note: i've set my html file to charset = GBK
//prototype of Search engine...
//workable for GBK input and output...
import java.io.*;
import java.io.OutputStream;
import java.io.IOException;
import javax.servlet.http.*;
import javax.servlet.ServletException;
import java.util.*;
import java.sql.*;
import java.nio.charset.Charset;
public class SearchBeta extends HttpServlet {
private Vector musicDetails = new Vector();
private String query = "";
public void service (HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException, UnsupportedEncodingException {
query = req.getParameter ("T1");
System.out.println("before:"+query);
String type = req.getParameter ("D1");//type
query = req.getParameter ("T1");
//query = "������";
System.out.println("after:"+query);
getResults(type,query);
System.out.println("locale = :"+req.getLocale());
res.setContentType ("text/html;charset=GBK");
PrintWriter out = res.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<body bgcolor = \"black\">");
out.println("<font face = \"comic sans ms\" color=\"Cornsilk\">");
if (query.length()==0)
out.println ("Please key in your search query.");
else if (musicDetails.size()==0)
out.println ("Sorry, no results matching your search can be found.");
else {
out.println("<center>");
out.println("<table cellspacing = \"50\">");
int i = 0;
//Display the details of the music
while (i<musicDetails.size()) {
Results details = (Results)musicDetails.get(i);
String dbArtist = "";
String dbAlbum = "";
String dbTitle = "";
String dbCompany = "";
dbAlbum = details.getAlbum();
dbTitle = details.getTitle();
dbCompany = details.getCompany();
dbArtist = details.getArtist();
try{
dbAlbum = new String(dbAlbum.getBytes("ISO-8859-1"),"GBK");
dbTitle = new String(dbTitle.getBytes("ISO-8859-1"),"GBK");
dbCompany = new String(dbCompany.getBytes("ISO-8859-1"),"GBK");
dbArtist = new String(dbArtist.getBytes("ISO-8859-1"),"GBK");//correct translation.
catch(UnsupportedEncodingException e){
System.out.print(e);
e.printStackTrace();
String dbImage_loc = details.getImage();
out.println("<tr>");
out.println("<td><table>");
out.println("<img src=C:\\Program Files\\Apache Group\\Tomcat 4.1\\webapps\\examples\\ThumbNails\\"+dbImage_loc+">");
out.println("<tr>");
out.println("<th><font color=\"violet\"> Artist: </font></th>");
out.println("<td><font color=\"Cornsilk\">"+dbArtist+"</font></td>");
out.println("</tr>");
out.println("<tr>");
out.println("<th><font color=\"violet\"> Title: </font></th>");
out.println("<td><font color=\"Cornsilk\">"+dbTitle+"</font></td>");
out.println("</tr>");
out.println("<tr>");
out.println("<th><font color=\"violet\"> Company: </font></th>");
out.println("<td><font color=\"Cornsilk\">"+dbCompany+"</font></td>");
out.println("</tr>");
System.out.println("album: "+ dbAlbum);
out.println("<tr>");
out.println("<th><font color=\"violet\"> Album: </font></th>");
out.println("<td><font color=\"Cornsilk\">"+dbAlbum+"</font></td>");
out.println("</tr>");
System.out.println("company: "+ dbCompany);
out.println("</table></td>");
out.println("</tr>");
i++;
out.println("</table>");
out.println("</center>");
out.println("</font>");
out.println("</body>");
out.println("</head>");
out.println("</html>");
out.close();
//to remove all the elements from the Vector
musicDetails.removeAllElements();
//get Searched Music Details and store in Results object which is stored in musicDetails vector
public void getResults (String type, String searchQuery) {
try {
Class.forName ("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=music","sa","kokkeng");
Statement stmt = con.createStatement();
String query = "SELECT * FROM MusicDetails WHERE "+type+" = '"+searchQuery+"'";
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
String artist = rs.getString("Artist");
String title = rs.getString("Song");
String company = rs.getString("Company");
String album = rs.getString("Album");
String image_loc = rs.getString("Image");
Results details = new Results (artist,title,company,album,image_loc);
musicDetails.add(details);
stmt.close();
con.close();
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
with the above servlet i created, i can search out the data in the database which i've inserted through the insert statement. I still can't search for things i've keyed into the database directly using NJStar..
thank you so much for helping.. really hope any one else who knows the answer to this will reply too... thank you all so much...
-KK -
Update with a select statement
hi experts,
I need some help again.. :)
I have an insert query here with a select statement.. Juz wondering how to do it in update?
insert into newsmail_recipient
(IP_RECIPIENTID,NF_LISTID,NF_STATUSID,D_CREATED,D_MODIFIED,C_NAME,C_EMAIL,USER_ID,NEWSMAIL_ID)
select newsmail_recipientid_seq.nextval
, liste
, 1
, sysdate
, sysdate
, null
, null
, ru.nf_userid
, null
from roleuser ru, unit u, userinfo ui
where u.ip_unitid = ru.nf_unitid
and u.ip_unitid = unit_id
and ui.ip_userid = ru.nf_userid
and ui.nf_statusid = 1
and n_internal = 0
and ui.ip_userid not in (select user_id
from newsmail_recipient
where user_id = ui.ip_userid
and nf_listid = liste
and nf_statusid = 1);let me know your thoughts.
Regards,
jpHi,
924864 wrote:
... I have an insert query here with a select statement.. Juz wondering how to do it in update?How to do what, exactly?
MERGE can UPDATE existing rows, and INSERT new rows at the same time. In a MERGE statement, you give a table or a sub-query in the USING clause, and define how rows from that result set match rows in your destination table. If rows match, then you can UPDATE the matching row with values from the sub-query.
Very often, MERGE is easier to use, and perhaps more efficient, than UPDATE just for changing existing rows. That is, while MERGE can do both INSERT and UPDATE, it doesn't have to . You can tell MERGE just to do one or the other if you wish.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Since you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
Index not being used in Select statement
Friends
I have the following SQL statement:
SELECT
a.acct,
a.date_field,
UPPER(b.feegroup) feegrp,
SUM (a.fee1) fee1,
SUM (a.fee2) fee2,
SUM (a.fee3) fee3
FROM table1 a, table2 b
WHERE 1 = 1
AND a.fee_id = b.fee_id
GROUP BY a.acct, a.date_field, b.feegroup;
Both the tables have index on fee_id column. When I run the explain plan for this statement, I am getting the following output:
Operation | Option | Object Name | Position
SELECT STATEMENT | | | 560299
HASH | GROUP BY| |1
TABLE ACCESS | FULL| table2 | 1
TABLE ACCESS | FULL| table1 | 2
Why Oracle is not using the index?
Edited by: darshilm on Dec 10, 2009 3:56 PMThe proposed plan is the optimal according to your current conditions in the "where clause" where you have only the equality join condition and therefore the CBO can use HASH JOIN. Using any kind of index access would just increase the amount of required work unless you would add some very restrictive conditions which will select rows from relatively small amount of blocks. Here I have to mention that what really counts in the CBO cost calculation is the amount of blocks accessed and not the number of rows. The "currency" for I/O in Oracle is a block and not a row. CBO always uses an assumption that there is nothing in the buffer cache and it will have to perform a physical read for every block.
How many blocks will actually be accessed depends on the data distribution. It can happen that every single row that you have to retrieve resides in a different block and although you access only 1000 rows out of a million row table you would have to visit almost every block of that table. For such a situation a FULL TABLE SCAN is the best access path and Oracle will use multiblock I/O for that. On the other side you can have those 1000 rows only in a few blocks and then the index access would be the most appropriate one. For index access Oracle uses single block I/O. Usually the actual situation is somewhere between this two extreme situations. But you can run some tests by yourself and see when an index access will be replaced by a full table scan while you will make your predicates less selective.
HTH, Joze
Co-author of the forthcoming book "Expert Oracle Practices"
http://www.apress.com/book/view/9781430226680
Oracle related blog: http://joze-senegacnik.blogspot.com/
Blog about flying: http://jsenegacnik.blogspot.com/
Blog about Building Ovens, Baking and Cooking: http://senegacnik.blogspot.com -
Bind variables are not used in select statement
Hello all of you,
I have two parameters in Report 6i.
1) Department
2) Section
There are many section in a single department. Both parameters are selected from list. The list for department name is as follows -
select deptname from department_master order by deptname
It works very well. The value is stored in :p_dept_name.
I want to display section of selected department only using following code :-
select sectname from section_master a, department_master b where a.deptcode = b.deptcode and b.deptname = :p_dept_name
The value is stored in :p_sect_name.
But it does not work. bind variables are not allowed in select statement, then how can I do this???
Please suggest me.
Thanx,
Regards,Vikas,
the forum is full of threads about that.
Dependent Parameters in Reports are possible out-of-the-box in Reports.
If you're running your report on the web, have a look at Metalink Note:185951.1
Regards
Rainer -
Function returning cursor to be used in select statement
I have written a function which returns a cursor. I want to use this in a select statement to display rows. How to do this.
Eg : function - test_fn return sys_refcursor. (returns empno, empname, deptname)
select test_fn from dual
This should return
empno empname deptno
1 name1 dept1
2 name 2 dept2
....Try This::
SCOTT@xe_144>variable c refcursor
SCOTT@xe_144>CREATE OR REPLACE FUNCTION get_nm
2 RETURN sys_refcursor
3 AS
4
5 c sys_refcursor;
6 BEGIN
7
8 open c for 'SELECT ENAME , SAL FROM EMP';
9
10 RETURN c;
11 END;
12 /
Function created.
SCOTT@xe_144>select get_nm into :c from dual;
GET_NM
CURSOR STATEMENT : 1
CURSOR STATEMENT : 1
ENAME SAL
SMITH 800
ALLEN 1600
WARD 1250
JONES 2975
BLAKE 2850
CLARK 2450
KING 3000
AKASH2 5000
TURNER 1500
ADAMS 1100
JAMES 950
MILLER 1300
ABC 2000
13 rows selected.Let me know if its works for you. -
ORA-00911: invalid character using multiple select statements
I am getting an ORA-00911: invalid character error when trying to execute 2 select statements using ODP.NET.
cmd.CommandText = "select sysdate from dual;select sysdate from dual;";
cmd.Connection = conn;
cmd.CommandType = System.Data.CommandType.Text;
conn.Open();
OracleDataReader dr = cmd.ExecuteReader();
This works in SQL server but for some reason it appears this does not work in Oracle?
If this is the case what is a vaiable workaround? Wrapping the 2 statements in a transaction?
Seems strange that you can't return multiple result sets using in-line sql statements.Oracle doesn't support passing multiple statements like that, and this is unrelated to ODP.NET.
SQL> select * from emp;select * from dept;
select * from emp;select * from dept
ERROR at line 1:
ORA-00911: invalid character
You could do it via an anonymous block and ref cursors though if you dont want to do it via a stored procedure..
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
public class test
public static void Main()
using (OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;"))
con.Open();
string strSql = "begin open :refcur1 for select * from emp;" +
"open :refcur2 for select * from dept;" +
"open :refcur3 for select * from salgrade;end;";
using (OracleCommand cmd = new OracleCommand(strSql, con))
cmd.Parameters.Add("refcur1", OracleDbType.RefCursor, ParameterDirection.Output);
cmd.Parameters.Add("refcur2", OracleDbType.RefCursor, ParameterDirection.Output);
cmd.Parameters.Add("refcur3", OracleDbType.RefCursor, ParameterDirection.Output);
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
cmd.Parameters["refcur1"].Dispose();
cmd.Parameters["refcur2"].Dispose();
cmd.Parameters["refcur3"].Dispose();
foreach (DataTable dt in ds.Tables)
Console.WriteLine("\nProcessing {0} resultset...", dt.ToString());
foreach (DataRow row in dt.Rows)
Console.WriteLine("column 1: {0}", row[0]);
}Hope it helps,
Greg -
Hi,
I am working on a report what has 10 datasets derived from 10 different select statements.
Is it possilbe to save those 10 select statements as a macro / stored procedure and then use that macro to generate those dataset in the ssrs report builder ?
AshishSinghalHi AshishSinghal84,
According to your description, you want to write multiple select statements in a procedure, then use the procedure as dataset in the report, right?
According to my knowledge, when we write multiple select statements in a procedure, we have to create relationship between these select statements, otherwise it will only return the first one query's fields. If you are using SSRS 2008 R2, you can use Lookup
function to display these fields from different datasets on one data region control, but the prerequisite is that you must have one common field. For more information about lookup function, please see:
http://msdn.microsoft.com/en-us/library/ee210531.aspx
If all these solution you cannot achieve due to your special condition, the last workaround is to use subreport to display all the fields together.
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
SELECT OPTIONS use in select statement
hi,
I have defined my selection screen in the main program.
selection-screen begin of screen 0101 as subscreen.
selection-screen begin of block b1.
select-options: S_KUNNR for KNA1-KUNNR,
selection-screen end of block b1.
selection-screen end of screen 0101.
then in an include in the same module pool, i try to use this in select statement
SELECT * INTO CORRESPONDING FIELDS OF XXX FROM ZPPP WHERE KUNNR IN S_KUNNR.
I get an error saying " the IN operator with S_KUNNR is neither followed by an internal table nor by a valuelist "..what does this mean ?
thksCheck the sample code...
REPORT ztest_mod.
DATA: kunnr TYPE kunnr.
* Custom Selection Screen 0200
SELECTION-SCREEN BEGIN OF SCREEN 0200 AS SUBSCREEN.
SELECT-OPTIONS: s_kunnr FOR kunnr.
SELECTION-SCREEN END OF SCREEN 0200.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_kunnr-low.
BREAK-POINT.
START-OF-SELECTION.
"in this screen i have a button with function code 'SEARCH'
" and a subscreen area with name sub
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
ENDMODULE. "status_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
DATA: it_kunnr TYPE TABLE OF kna1.
CASE sy-ucomm.
WHEN 'SEARCH'.
SELECT * FROM kna1
INTO TABLE it_kunnr
WHERE kunnr IN s_kunnr.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "user_command_0100 INPUT
in the flow logic..
PROCESS BEFORE OUTPUT.
MODULE status_0100.
CALL SUBSCREEN sub INCLUDING sy-repid '0200'.
PROCESS AFTER INPUT.
MODULE user_command_0100.
Regards
Vijay Babu Dudla -
Calculation using multiple select statements - APEX 4.0
Hello,
I am new to APEX, PL/SQL and have some SQL knowledge, but I pick up things quickly. I want to make a page item equal to the value of a Select statement minus another Select statement. The statements pull from the same tables and only differ slightly in the where clause. I do not know the best way to create this calculation. Can someone please assist.
Select Statement #1
select sum(JE_TRANSACTIONS.DEBIT_AMOUNT) as "Release"
from "REVREC_FORMS" "REVREC_FORMS",
"JOURNAL_ENTRIES" "JOURNAL_ENTRIES",
"JE_TRANSACTIONS" "JE_TRANSACTIONS"
where "JOURNAL_ENTRIES"."RELATED_REVREC"="REVREC_FORMS"."REVREC_ID"
and "JOURNAL_ENTRIES"."RECORD_ID_"="JE_TRANSACTIONS"."RELATED_JOURNAL_ENTRY"
and "JOURNAL_ENTRIES"."RELEASE_TYPE" ='Release'
and "JOURNAL_ENTRIES"."REVENUE_TYPE" ='Software'
and "REVREC_FORMS"."REVREC_ID" =:P12_REVREC_ID
Select Statement #2
select sum(JE_TRANSACTIONS.DEBIT_AMOUNT) as "Deferral"
from "REVREC_FORMS" "REVREC_FORMS",
"JOURNAL_ENTRIES" "JOURNAL_ENTRIES",
"JE_TRANSACTIONS" "JE_TRANSACTIONS"
where "JOURNAL_ENTRIES"."RELATED_REVREC"="REVREC_FORMS"."REVREC_ID"
and "JOURNAL_ENTRIES"."RECORD_ID_"="JE_TRANSACTIONS"."RELATED_JOURNAL_ENTRY"
and "JOURNAL_ENTRIES"."RELEASE_TYPE" ='Deferral'
and "JOURNAL_ENTRIES"."REVENUE_TYPE" ='Software'
and "REVREC_FORMS"."REVREC_ID" =:P12_REVREC_IDHow about
select sum(decode(release_type,'Deferral',je_transactions.debit_amount)) - sum(decode(release_type,'Release',je_transactions.debit_amount)) as result
from "REVREC_FORMS" "REVREC_FORMS",
"JOURNAL_ENTRIES" "JOURNAL_ENTRIES",
"JE_TRANSACTIONS" "JE_TRANSACTIONS"
where "JOURNAL_ENTRIES"."RELATED_REVREC"="REVREC_FORMS"."REVREC_ID"
and "JOURNAL_ENTRIES"."RECORD_ID_"="JE_TRANSACTIONS"."RELATED_JOURNAL_ENTRY"
and "JOURNAL_ENTRIES"."REVENUE_TYPE" ='Software'
and "REVREC_FORMS"."REVREC_ID" =:P12_REVREC_IDScott
Maybe you are looking for
-
Error - Unable to find "Adobe PDF" resource files
When attempting to create a PDF from a "dot DOC file" I receive "Unable to to find Adobe PDF resource files." As part of the message the dialog box asks if I want to run install in repair mode. I have clicked the "yes" button but the problem remain
-
Javascript to Java using APPLET TAG
Can I call an applet method using Javascript? The applet is exposed through the <APPLET> tag. I can easily do it using MS JVM but Sun JVM doesn't let me do it. I look at the plug-in documentation and it only mention using <OBJECT> when doing Javasrip
-
Fastest type of data repository vi
I have inherited a large LV application that in some instances runs VERY slowly. This is almost exclusively due to data transfers either between the application and the database or between some vis accessing data in repository vis. The first time dat
-
Puma 10.1 Free Upgrade (Can we still get our hands on this upgrade)
Wondering if it is possible for Apple to make available the 10.1 (free upgrade) that was sent to those of us who purchased Cheetah about 10 years ago. This seems to be an update in high demand based on other posts and I can't seem to find it anywhere
-
[svn:fx-4.0.0] 13667: TLB Build 591.
Revision: 13667 Revision: 13667 Author: [email protected] Date: 2010-01-20 11:30:00 -0800 (Wed, 20 Jan 2010) Log Message: TLB Build 591. Approved for checkin. Looks like an IME focus issue was fixed. QE notes: Doc notes: Bugs: Reviewer: Tests