Output varies for group by & where Clause
Below are the two statements which i am comapring .
1) for this i get a output as it displays 0 because there are no rows matched to this criteria .
select count(No) from T1 where No = 3"
1
0
1 record(s) selected.
2) Same way i am looking to get output for this statement .If value exists it gives the count if not it should return 0.
select count(*) from T1 GROUP BY No HAVING No = 3"
1
0 record(s) selected.
Can someone suggest this
user587133 wrote:
Below are the two statements which i am comapring .
1) for this i get a output as it displays 0 because there are no rows matched to this criteria .
select count(No) from T1 where No = 3"
1
0
1 record(s) selected.
2) Same way i am looking to get output for this statement .If value exists it gives the count if not it should return 0.
select count(*) from T1 GROUP BY No HAVING No = 3"
1
0 record(s) selected.
Can someone suggest thisIn the second query the having clause is applied after the count, so the count is being done and then any rows matching the having clause are returned. As there are no rows matching the having clause the result is that no rows are returned. The count is being done, but you are filtering out those rows from the result.
Similar Messages
-
How to create a procedure to output REF CURSOR with any WHERE clause?
I have an requirement like this: I have huge query which need to reuse in my code more than 10 times. This SQL has about 50 lines. Thing is for those 10 odd times sometimes the WHERE clause changes (columns are the same). So I cannot create a view since SQL is not static.
I thought of writing a procedure with a WHERE_CLAUSE input para. I output a sys refcursor by adding the where clause. But I can't do it since you cannot add a where clause like that.
i.e.
PROCEDURE dynamyic_query (p_where_clause IN VARCHAR2, p_out_query OUT SYS_REFCURSOR ) IS
BEGIN
OPEN p_out_query FOR SELECT ......... FROM table WHERE || ' ' || p_where_clause;
END;The above gives error.
How to handle a situation like this???? Any help would be greatly appreciated.I tried this method:
I created a table tab_test which has these records:
TNAME TABTYPE CLUSTERID
ABS_V4_P_ERROR_MESSAGES TABLE
ABS_V4_P_ORG_PARAM TABLE
ABS_V4_P_PARAMETER TABLE
ABS_V4_P_SYS_PARAM TABLE
ACCINTERFACE_PARAMETERS TABLE
ACCOUNTS TABLE
ACCOUNT_EXTRACT_PERIODS TABLE
ACCOUNT_EXTRACT_PERIODS# TABLE
ACCOUNT_EXTRACT_PERIODS_1 TABLE Now I create this proc:
PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS
v_stmt VARCHAR2(1000);
BEGIN
v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND tabtype = :x';
OPEN p_out_cursor FOR v_stmt using p_where_cluase;
END;I create this code block and run it:
declare
v_tname varchar2(200);
out_cursor sys_refcursor;
begin
forms_text_dyn_sql_test('TABLE', out_cursor );
LOOP
fetch out_cursor INTO v_tname;
exit when out_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_tname);
END LOOP;
end;
/I get correct output:
ABS_V4_P_ERROR_MESSAGES
ABS_V4_P_ORG_PARAM
ABS_V4_P_PARAMETER
ABS_V4_P_SYS_PARAMHowever, when I change the proc like this:
PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS
v_stmt VARCHAR2(1000);
BEGIN
v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND :y';
OPEN p_out_cursor FOR v_stmt using p_where_cluase;
END;And run this code block:
declare
v_tname varchar2(200);
out_cursor sys_refcursor;
begin
forms_text_dyn_sql_test(' 1 = 1 ', out_cursor );
LOOP
fetch out_cursor INTO v_tname;
exit when out_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_tname);
END LOOP;
end;
/I get error:
[1]: (Error): ORA-00920: invalid relational operator ORA-06512: at "ABS.FORMS_TEXT_DYN_SQL_TEST", line 6 ORA-06512: at line 5Looks like you can only put column_name = :z, column_name = :y type values. You cannot it seems replace it with any WHERE CLAUSE???? -
Programmatically setting UI Hints for runtime named where clause params
Hi,
At runtime, I've added some named where clause parameters to my view object instance, set the where clause and then executed the query. Then, when navigating to the target page, where a af:query panel is shown and a af:table shows the filtered results, I see the bind variables I've just created appearing in the search area as mandatory fields.
My question is: how can I hide those runtime bind variables?
Thanks
JDeveloper 11.1.1.3.0I do want where clauses to be created at runtime instead of design time to improve DB performance
whereClause += "AND DEPARTMENT_ID = " + departmentId;Marge -
What you are doing is a recipe for POOR performance, not good performance. String concatenation in a where clause with no bind variables... ugh! Poor performance + poor security (you are now susceptible to SQL injection attacks).
I suggest that you do this at design time (where possible) and have a read of the documentation about view criteria.
And please, no matter what approach you use, PLEASE PLEASE PLEASE start using bind variables and not just jamming strings together to make your where clause, otherwise you are heading straight for disaster. I cannot stress this enough.
John -
Next-Previous Do not work Properly for lengthly dynamic Where Clause
I have created a View object using Expert Query mode
with following Query:
SELECT LIC_SYS_ID,
LIC_NAME,
TERRITORIES,
LANGUAGES,
MEDIA,
SEGMENT_NAME,
CHANNELS,
ACTIVITY_CD,
LS.LIC_SHORT_NAME,
LS.LIC_AKA_NAME
FROM V_LICENSEE_SEARCH LS
ORDER BY LIC_NAME
Then at run time the following Where Clause staments get added by in JSP based on the users criteria
wClause = "(ACTIVITY_CD = '" + activityStatus + "')"
+ " AND " +
"(LIC_NAME like '" + licenseeName + "%' OR " +
" LIC_SHORT_NAME like '" + licenseeName + "%' OR " +
" LIC_AKA_NAME like '" + licenseeName + "%' ) "
In this case the DataScroller does not work properly It DataTable traves only one setp when I click the "Next" link, But if I use the Drop down list of the Scroller its works fine.
Secondly the "Next" "Previous" links of the DataScroller work fine if I use only one stmt in the WhereClause ex: "ACTIVITY_CD LIKE 'A%'".
Can anybody help me with this, Is this a limitation of DataScroller/DataTable/DataSource tags why does it not work??
Please help me its urgent.
Thanks a ton !!Thx for the reply, I did try your suggestion It did not throw any exception. Here is the log messages after enabling jbo Debug.
[391] Reusing a cached session application module instance
[392] Getting a connection for internal use...
[393] Creating internal connection...
[394] Oracle SQLBuilder: Registered driver: oracle.jdbc.driver.OracleDriver
wClause : (ACTIVITY_CD = 'A') AND (LIC_NAME like 'A%' OR LIC_SHORT_NAME like 'A%' OR LIC_AKA_NAME like 'A%' )
[395] Column count: 10
[396] ViewObject : Reusing defined prepared Statement
[397] $$added root$$ id=-2
[398] Application Module failover is enabled
[399] Getting a connection for internal use...
[400] Creating internal connection...
[401] Oracle SQLBuilder: Registered driver: oracle.jdbc.driver.OracleDriver
[402] <AM MomVer="0">
<cd/>
<VO>
<VO Sz="8" St="8" Def="com.sophoi.ipls.media.tv.businessentities.licensee.LicenseeView" Name="licenseeView">
<Wh>
<![CDATA[(ACTIVITY_CD = 'A') AND (LIC_NAME like 'A%' OR LIC_SHORT_NAME like 'A%' OR LIC_AKA_NAME like 'A%' )]]>
</Wh>
<Or>
<![CDATA[LIC_NAME ASC]]>
</Or>
</VO>
</VO>
</AM>Long postings are being truncated to ~1 kB at this time. -
Using 'between' for literals inside 'where' clause
Dear all,
I run the following queries in 10.g XE HR sample schema:
The first query is limited by characters between "I" and "S" where the second query is limited by words between "IT" and "Sales".
My question is, how come the first query doesn't return "Sales" row as it does in the second one? I don't quite understand how does "between" works on string literals. Please help.
Regards,
Valerie
SQL> select department_name from departments where department_name between 'I' a
nd 'S' order by department_name;
DEPARTMENT_NAME
IT
IT Helpdesk
IT Support
Manufacturing
Marketing
NOC
Operations
Payroll
Public Relations
Purchasing
Recruiting
DEPARTMENT_NAME
Retail Sales
12 rows selected.
SQL> select department_name from departments where department_name between 'IT'
and 'Sales' order by department_name;
DEPARTMENT_NAME
IT
IT Helpdesk
IT Support
Manufacturing
Marketing
NOC
Operations
Payroll
Public Relations
Purchasing
Recruiting
DEPARTMENT_NAME
Retail Sales
Sales
13 rows selected.Imagine how those words are ordered in an encycopedia or thesaurus.
1. I
2. IT
3. IT Helpdesk
4. IT Support
5. Manufacturing
6. Marketing
7. NOC
8. Operations
9. Payroll
10. Public Relations
11. Purchasing
12. Recruiting
13. S
14. Sales
15. System Management
"S" is ordered before "Sales". Between includes everything including the lower and the upper boundary (row 1-13). It does not include stuff that is ordered AFTER the upper boundary (Row 14++).
So if you want to find everything the starts with "S" then you have several options.
1) Show everything after including "I" but before "T" (T not including)
select department_name
from departments
where department_name >= 'I'
and department_name < 'T'
order by department_name;or
2) Show everything where the first letter is between "I" and "S"
select department_name
from departments
where substr(department_name,1,1) between 'I' and 'S'
order by department_name;I would almost always choose the first option. Usually it is faster because an index on the department name can be used if there is one.
There is a third option. But this is kind of silly and incomplete. You could add the very last string that you can imagine as the upper boundary of the between function.
select department_name
from departments
where department_name between 'I' and 'Szzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
order by department_name;Edited by: Sven W. on Dec 14, 2010 12:54 PM - added third option -
How to write a java function for use in where clause in SQL statement
Hi,
Does anyone know a good tutorial on how to write and include a Java class/function into Oracle.
I'd like to write mathematical function to use in my queries, but the resources available in PL/SQL are very limited.
Many thanxPim,
I see you got an answer in the PL/SQL forum.
But in case you haven't seen it, perhaps this Web page will help:
http://www.oracle.com/technology/tech/java/jsp/index.html
Good Luck,
Avi. -
Dear Consultants,
I want to take a print out from Group Deliveries I did the output determination, created the output condition record and created the group delivery when am trying to take the print out system giving the message that
No output has been selected for printing
, system not considering the condition record. when ever i want to print the group delivery, manuallay I am enter the information because of the above problem.
some one can help to fixup this.
Thanks and Regards,
MHCheck in the following IMG path
Logistics Execution => Shipping => Basic Shipping Functions => Output Control => Output Determination => Maintain Output Determination for Groups => Maintain Output Determination Procedure.
Here ensure that you have maintained the required condition type there. Next click "Assign Output Determination Procedures" and ensure that you have assigned the required output procedure for your Group Type
thanks
G. Lakshmipathi -
Variable for entire where clause
Is it possible to use a variable for the entire where clause in a PL/SQL select statement?
I have a where clause stored as a string in the database and I want to use that entire string as a variable, but my procedure will not compile because it is missing the relational operator.
SELECT whereclause FROM clausetable WHERE clause = 'TEST'; will return this string: column1 = 'abc'
Here's my procedure:
create or replace
PROCEDURE TESTWC
(c_out OUT sys_refcursor )
AS
BEGIN
DECLARE
v_whereclause VARCHAR2(255);
BEGIN
SELECT whereclause
INTO v_whereclause
FROM clause_table
WHERE clause = 'TEST';
DBMS_OUTPUT.PUT_LINE(v_whereclause);
OPEN c_test FOR SELECT * FROM dpacsoftware WHERE v_whereclause;
NULL;
END;
END TESTWC;Is it possible to use a variable for the entire where clause in a PL/SQL select statement?Unfortunately yes.
I have a where clause stored as a string in the databaseThis is a really bad idea, like storing the source for half your program in a text file with a bunch of Java or C or FORTRAN code and opening, reading, compiling and linking at run time.
It is slow, slow, slow as you can expect, and dangerous and insecure, since someone could have put a format C: command in your source file, or something equivalently nasty to a database. -
hi,
can we use output of a function in where clause directly ?
i.e
select node(condition1) clause from dual;
clause
occupation='SALARY'
then i want to use this output i.e clause string directly in select stmt.
select * from abc_table where clause
more strictly
select * from abc_table where (select node(condition1) clause from dual)
which is interpreted as
select * from abc_table where occupation='SALARY'
Is there any way to use functions in clause area ???
I tried CURSOR but not workd for this
Thanks in advance,
RupI cant really understand your problem
--fn1 is a function
sql>
select fn1
from dual;
FN1
CLERK
sql>
select * from emp
where job = fn1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7934 MILLER CLERK 7782 23-JAN-82 1300 10
Message was edited by:
jeneesh -
Hi,
Please could someone give me the syntax for expressing a where clause in SQL Loader control file? as an example i only want the data in the columns to be uploaded where person_id matches the person_id already present in the table.
My control file is below which needs amending to include a 'Where'. The append will also need changing i assume.
load data
infile '/app/DEV/appl/xxcpp/11.5.0/bin/TEST.csv'
APPEND
into table XXCPP_SQL_LOADER_TEST
fields terminated by "," optionally enclosed by '"'
( PERSON_ID, EMP_NAME, EMP_NUMBER, START_DATE DATE "fmDD/MM/RRRR" )
Many ThanksSQL*Loader has very limited conditional load capabilities. WHEN clause does not support OR (and it is documented). Anyway, you could do the following. Control file:
load data
infile *
APPEND
into table XXCPP_SQL_LOADER_TEST
When Person_id = '1'
fields terminated by "," optionally enclosed by '"'
( PERSON_ID POSITION(1), EMP_NAME, EMP_NUMBER, START_DATE DATE "fmDD/MM/RRRR" )
into table XXCPP_SQL_LOADER_TEST
When Person_id = '2'
fields terminated by "," optionally enclosed by '"'
( PERSON_ID POSITION(1), EMP_NAME, EMP_NUMBER, START_DATE DATE "fmDD/MM/RRRR" )
into table XXCPP_SQL_LOADER_TEST
When Person_id = '3'
fields terminated by "," optionally enclosed by '"'
( PERSON_ID POSITION(1), EMP_NAME, EMP_NUMBER, START_DATE DATE "fmDD/MM/RRRR" )
begindata
1,A,11,13/01/2011
2,B,12,13/01/2011
3,C,13,13/01/2011
4,D,14,13/01/2011
5,D,15,13/01/2011
{code}
Now:
{code}
SQL> select * from XXCPP_SQL_LOADER_TEST;
no rows selected
SQL> host sqlldr scott/tiger control=c:\temp\XXCPP_SQL_LOADER_TEST.CTL log=c:\temp\XXCPP_SQL_LOADER_TEST.LOG
SQL> select * from XXCPP_SQL_LOADER_TEST;
PERSON_ID EMP_NAME EMP_NUMBER START_DAT
1 A 11 13-JAN-11
2 B 12 13-JAN-11
3 C 13 13-JAN-11
SQL>
{code}
SY. -
Hi Experts,
We have a typical requirement for including the where clause dynamically. Here is the Scenario:
We will be getting the Where Clause as a string parameter value from reporting framework. This needs to be appended in Crystal Reports with Select Clause.
Here is an example. We will be getting the Where parameter value as
clnt_id=1001 and acct_no=232 and cust='XYZ'
This will be passed as a single string to CR which needs to act as Where Clause while the CR query hits database.
Not sure how to implement this. Any suggestions will be of great help.
Thanks
NareshAs far as I'm aware, there are no other solutions, unless you want to parse the Where clause string in Crystal and code the possibilities. This might be reasonable if there are only a couple of fields that possibly would be used in the where clause of any given report, but tedious and slow if there are hundreds. Report performance will suffer in any case because the database will not be performing the Where clause, so more data will be passed back to Crystal which it will have to determine needs to be dropped.
I don't know how many existing reports you're dealing with, but it might not be overly time consuming to change the reports to be based on an SQL Command. After all, Crystal can give you the SQL that it intends to use when a report is defined based on tables and views... IMHO, I see the benefit of using an SQL Command and have the database do the Where clause worth while in this case...
HTH,
Carl -
Prompted value corrupts SQL WHERE clause - bug?
Using 10.1.3.4...
I implemented a simple pivot based request that navigates to a second request when the user drill down on one of the fields. This field is set to "value is prompted" in my second request. (I chose navigate method above drill (dimensions) for a few reasons not really important to this posting, mainly to do with format of requests at different levels)
All good and the drill down works well, parameters are passed correctly, except then I noticed that totals in my second request doesn't accurately tie back to my first request. After some research I found a very odd reason for this, my WHERE clause is getting corrupted - which almost looks like a bug in OBIEE and were wondering if anybody else has seen this behaviour from OBIEE and know a work around (before I try the Oracle support channels)
From Answers the request SQL is (I'll highlight the lines getting messed up):
SET VARIABLE DISABLE_CACHE_HIT = 1;
SELECT
BUSINESS_UNIT.Segment saw_0, BUSINESS_UNIT."Business Unit" saw_1, OPPORTUNITY.CLOSEPROBABILITY saw_2, OPPORTUNITY.CLOSEPROBABILITY saw_3, YEAR(OPPORTUNITY.ESTIMATEDCLOSE) saw_4, OPPORTUNITY_ADDON.TCV_IN_USD/1000000 saw_5, OPPORTUNITY_ADDON.WEIGHTED_TCV_IN_USD/1000000 saw_6, CASE OPPORTUNITY.CLOSEPROBABILITY WHEN 100 THEN OPPORTUNITY_ADDON.TCV_IN_USD/1000000 ELSE 0 END saw_7 FROM "Sales"
WHERE (OPPORTUNITY.STAGE NOT IN ('Lost', 'On Hold')) AND (YEAR(OPPORTUNITY.ESTIMATEDCLOSE) >= YEAR(CURRENT_DATE)) AND
((({color:#ff0000}OPPORTUNITY.CLOSEPROBABILITY > 25) AND (TIMESTAMPDIFF(SQL_TSI_MONTH, CURRENT_DATE,OPPORTUNITY.ESTIMATEDCLOSE) <= 4)) OR ((OPPORTUNITY.CLOSEPROBABILITY >= 10) AND (TIMESTAMPDIFF(SQL_TSI_MONTH, CURRENT_DATE,OPPORTUNITY.ESTIMATEDCLOSE) > 4{color})))
ORDER BY saw_0, saw_1, saw_2, saw_3, saw_4, saw_5, saw_6, saw_7
Which results in the following SQL request (from NQQuery.log)... The prompted value (BUSINESS_UNIT.Segment) is added correctly to the WHERE clause, but see how the remainder get's changed:
SQL Request:
SET VARIABLE QUERY_SRC_CD='Report',SAW_DASHBOARD='/shared/01 - Financials/_portal/4. Pipeline',SAW_DASHBOARD_PG='Pipeline',SAW_SRC_PATH='/shared/01 - Financials/4. Pipeline/Pipeline - Current - T2',DISABLE_CACHE_HIT = 1;
SELECT
BUSINESS_UNIT.Segment saw_0, BUSINESS_UNIT."Business Unit" saw_1, OPPORTUNITY.CLOSEPROBABILITY saw_2, OPPORTUNITY.CLOSEPROBABILITY saw_3, YEAR(OPPORTUNITY.ESTIMATEDCLOSE) saw_4, OPPORTUNITY_ADDON.TCV_IN_USD/1000000 saw_5, OPPORTUNITY_ADDON.WEIGHTED_TCV_IN_USD/1000000 saw_6, CASE OPPORTUNITY.CLOSEPROBABILITY WHEN 100 THEN OPPORTUNITY_ADDON.TCV_IN_USD/1000000 ELSE 0 END saw_7 FROM "Sales"
WHERE (BUSINESS_UNIT.Segment = 'Enterprise') AND (OPPORTUNITY.STAGE NOT IN ('Lost', 'On Hold')) AND (YEAR(OPPORTUNITY.ESTIMATEDCLOSE) >= YEAR(CURRENT_DATE)) AND
((({color:#ff0000}OPPORTUNITY.CLOSEPROBABILITY >= 10) AND (TIMESTAMPDIFF(SQL_TSI_MONTH, CURRENT_DATE,OPPORTUNITY.ESTIMATEDCLOSE) > 4)) OR ((OPPORTUNITY.CLOSEPROBABILITY >= 10) AND (TIMESTAMPDIFF(SQL_TSI_MONTH, CURRENT_DATE,OPPORTUNITY.ESTIMATEDCLOSE) > 4{color})))
ORDER BY saw_0, saw_1, saw_2, saw_3, saw_4, saw_5, saw_6, saw_7
Which definitely explains why my totals do not add up when drilling down. Interestingly, if I run my second request without the prompt from Answers, the SQL request works like a charm:
SET VARIABLE QUERY_SRC_CD='Report',SAW_SRC_PATH='/shared/01 - Financials/4. Pipeline/Pipeline - Current - T2',DISABLE_CACHE_HIT = 1;
SELECT BUSINESS_UNIT.Segment saw_0, BUSINESS_UNIT."Business Unit" saw_1, OPPORTUNITY.CLOSEPROBABILITY saw_2, OPPORTUNITY.CLOSEPROBABILITY saw_3, YEAR(OPPORTUNITY.ESTIMATEDCLOSE) saw_4, OPPORTUNITY_ADDON.TCV_IN_USD/1000000 saw_5, OPPORTUNITY_ADDON.WEIGHTED_TCV_IN_USD/1000000 saw_6, CASE OPPORTUNITY.CLOSEPROBABILITY WHEN 100 THEN OPPORTUNITY_ADDON.TCV_IN_USD/1000000 ELSE 0 END saw_7 FROM "Sales"
WHERE (OPPORTUNITY.STAGE NOT IN ('Lost', 'On Hold')) AND (YEAR(OPPORTUNITY.ESTIMATEDCLOSE) >= YEAR(CURRENT_DATE)) AND
((({color:#ff0000}OPPORTUNITY.CLOSEPROBABILITY > 25) AND (TIMESTAMPDIFF(SQL_TSI_MONTH, CURRENT_DATE,OPPORTUNITY.ESTIMATEDCLOSE) <= 4)) OR ((OPPORTUNITY.CLOSEPROBABILITY >= 10) AND (TIMESTAMPDIFF(SQL_TSI_MONTH, CURRENT_DATE,OPPORTUNITY.ESTIMATEDCLOSE) > 4{color})))
ORDER BY saw_0, saw_1, saw_2, saw_3, saw_4, saw_5, saw_6, saw_7
Anybody had the same problem before?Here's the excerpt (it's relative to crashing, but I think it should also address the bug):
# PRESENTATION SERVER CRASH AFTER UPGRADING TO 10.1.3.4 (Doc ID 756541.1)
crash when they run the reports containing Pivot Table. This has been a known issue with version ... subsequently upgraded to version
Doc Type:ALERTModified:2/10/2009 -
Output determination for ordering address
Hi
In our business, more than one ordering address might be available for the same vendor. Therefore, we need to send Purchase Orders to different Ordering Address for the same vendor.Kindly help how to maintian the output determination for this.
-PrabuHi Prabhu
Output determination
What is output?
Output is communication. When we create a transaction in sales & distribution, and save the transaction we may have to communicate to the concerned business partner about the transaction.
Example;
Customer--Purchase Order-VA01 (Create sales Order)- save the sales order- send the order confirmation to the customer
Here the output is Order confirmation
This output is sent to business partner-Customer-Sold to Party
Other Examples: Quotation, Invoice, Delivery note, Packing List
Output determination happens through Condition Technique.
Condition records are very important here. And these records contain answers to following questions.
a) What is the Output Type? Order confirmation or Invoice etc
b) Who is the recipient? A Sold-to-party or Payer etc.
c) What is the media? Take print out and send, or as email? Or Fax? Or EDI (Electronic data Interchange)
d) When output to be processed? Immediately when the transaction saved or scheduled to happen at particular Time etc
e) In which language the output to be prepared
Customization:
IMGSDBasic functionsOutput Control
Output Determination
Output Determination using Condition technique
Maintain Output Determination for Sales Documents
Maintain output types
SAP provides standard Output types for sales, shipping, transportation and billing
Sales:
AF00 Inquiry
AN00 Quotation
BA00 Order
RD03 Cash sales invoice
Each of this condition type has Repository data called Routines
a) Program---Program that reads data from tables (VBAK / many tables storing data pertaining header etc)
b) Form routineProgram used for creating layout
c) Form---Layout
The Output type has an Access sequence
Example: BA00 has access sequence 0010
Access sequence uses sales document type as the field under table 7
SAP provides standard Procedures, Copy the procedure and assign it to the Sales document Type
Select maintain output determination procedure
Position V10000 (Order Confirmation)
Select V10000 and Copy as
ZV1000 Kirlosakr Order Confirmation
Save
Assign output determination Procedure
Allocate Sales Document Header
Position ZKOR
Sales document Type Procedure
ZKOR ZV1000
Save
Now maintain Condition Records
SAP menuLogisticsSales & DistributionMaster data-Output--sales document
Create VV11
Sales Doc=ZKOR
Partner function=SP
Media=1 Printout
Date=4 immediately when saving transaction
Lang=EN
Now select Communication Tab
Printer= A000 virtual Printer
Save the Record
Create an order and check the Order Confirmation
Create VA01
Save
VA02- sales documentissue output to
Select BA00 and select Print review to see the Output
Outputs for shipping processes customization carried out under Logistics Execution
IMG MenuLogistics executionShippingBasic shipping Functions-Output Control-Output determination---
Maintain output determination for outbound deliveries
Std Delivery outputs
LD00 Delivery document
PL00 Packing List
Follow the same procedure, like in sales, Copy the std Procedure and assign to respective documents like Delivery document etc
Output determination for Groups---Used for picking list generation
Output determination for handling unitsfor packing
Reward if useful to u -
How to use a case statement in where clause
Hi All,
I have a requirement which is to bring all the claims that are created in the last month.So, i wrote a query something like this
select * from claims
where
(Month(ClaimOpenDate) = Month(Getdate())-1 and year(claimopendate) = year(getDate()))
which would give me any new claims created in last month of current year, but this condition fails if we are in the first month of a new year( lets say if we are in 2016 jan then month(getdate())-1 would be 0 and year(getdate()) would be 2016 so we dont
find any records where year is 2016 and month is 0 for claimopen).
So, i would like to use a case statament or something which can help me get around this one.
Can someone please help me with any suggestions?
ThanksHi Jason,
Thanks a lot for your help. This is what exactly i am looking for but i just gave a sample query above below is my original query
select
row_number() over (order by [ClaimNumber]) as DataElementName
,c.PolicyNumber as PolicyNum
, c.FirstName as CustNameF
,c.LastName as CustNameL
,c.PolicyForm as PolType
,'Homesite' as Company
,[ClaimNumber] as ClaimNum
,E.office as Ofc
,e.Supervisior_FullName as Team
, RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FORepF
, case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FORepL
,e.AdjusterID as RepC -- not sure
,CONVERT ( varchar,c.LossDate ,101) as DOL
,convert (varchar,c.ClaimOpenDate,101) as DOR
,rtrim(c.Loss_State) as LossSt
,c.Loss_ZipCode as LossZIP
,c.Loss_City as LossCity
,c.LossType as FOL
,'' as PR
,'' as PRNum
,1 as FeaNum
,'HO' as FeaType
,case when rtrim(c.claimStatus)= 'Closed' then 'Closed' else 'Open' end as FeaStat
,'' as FeaOpen
,'' as FeaClosed
,s.PaymentIndemnityAmount as PaidAmt
,s.ReserveIndemnityAmount as Reserve
,'' as Sub
,'' as Sal
,'' as FeatOwnOfc
,e.Supervisior_FullName as FeatOwnTeam
,RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FeatOwnRepF
,case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FeatOwnRepL
,e.AdjusterID as FeatOwnRepCode
,NULL AS Description --not sure
from [Stg].[HS_DW_RV_Claims] c
inner join [dbo].[Claims_Primary_Adjuster] a on a.CLAIM_NUMBER = c.ClaimNumber
inner join [dbo].[vw_Adjuster] e on e.adjuster_Name = a.primary_ADJUSTER
left outer join [Stg].[HS_DW_LossClaimSummary] s on c.ClaimKey=s.ClaimKey
where c.LoadSource = 'CMS'
and
(s.PaymentIndemnityAmount <>0 or s.PaymentExpenseAmount <>0)
and
ClaimOpenDate BETWEEN DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP) -1, 0) AND DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP), 0)
UNION ALL
select
row_number() over (order by [ClaimNumber]) as DataElementName
,c.PolicyNumber as PolicyNum
, c.FirstName as CustNameF
,c.LastName as CustNameL
,c.PolicyForm as PolType
,'Homesite' as Company
,[ClaimNumber] as ClaimNum
,E.office as Ofc
,e.Supervisior_FullName as Team
, RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FORepF
, case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FORepL
,e.AdjusterID as RepC -- not sure
,CONVERT ( varchar,c.LossDate ,101) as DOL
,convert (varchar,c.ClaimOpenDate,101) as DOR
,rtrim(c.Loss_State) as LossSt
,c.Loss_ZipCode as LossZIP
,c.Loss_City as LossCity
,c.LossType as FOL
,'' as PR
,'' as PRNum
,1 as FeaNum
,'HO' as FeaType
,case when rtrim(c.claimStatus)= 'Closed' then 'Closed' else 'Open' end as FeaStat
,'' as FeaOpen
,'' as FeaClosed
,s.PaymentIndemnityAmount as PaidAmt
,s.ReserveIndemnityAmount as Reserve
,'' as Sub
,'' as Sal
,'' as FeatOwnOfc
,e.Supervisior_FullName as FeatOwnTeam
,RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FeatOwnRepF
,case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FeatOwnRepL
,e.AdjusterID as FeatOwnRepCode
,DESCRIPTION --not sure
from Stg.IG_Document D
inner join [Stg].[HS_DW_RV_Claims] c on D.PARENTREF = C.ClaimNumber
inner join [dbo].[Claims_Primary_Adjuster] a on a.CLAIM_NUMBER = c.ClaimNumber
inner join [dbo].[vw_Adjuster] e on e.adjuster_Name = a.primary_ADJUSTER
left outer join [Stg].[HS_DW_LossClaimSummary] s on c.ClaimKey=s.ClaimKey
where c.LoadSource = 'CMS'
and
DESCRIPTION like '%Denial Letter%'
and
ClaimOpenDate BETWEEN DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP) -1, 0) AND DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP), 0)
So if i use your logic in the end for both the where clauses its been more than 10 minutes and the query is still running however if i use my old method it doesnt even take a second. Looks like its affecting the execution plan. Any suggestions to get around
this one please?
Thanks -
"Invalid Column" on multiple where clauses with subqueries and cfqueryparam
I'm seeing a behavior in the coldfusion cfquery that I'd like to find an exmplanation for . I've got a query that does a subquery in the select portion and if I have multiple where lines, I get an "invalid column name" message for my second where clause, but only when I'm using cfqueryparam
For example on the following I get "Invalid column name 'position_id'"
SELECT department_staff_tbl.*,
( SELECT max(bookmark_id)
FROM bookmarked_items_tbl
WHERE item_id = department_staff_tbl.staff_id
) AS bookmark_id
FROM department_staff_tbl
WHERE department_id = <cfqueryparam value="#arguments.deptid#" cfsqltype="cf_sql_integer">
AND position_id = <cfqueryparam value="#arguments.posid#" cfsqltype="cf_sql_integer">
AND staff_id = <cfqueryparam value="#arguments.staffid#" cfsqltype="cf_sql_integer">
If I change the order of my where clause so staff_id is first, then it tells me "department_id" is an invalid column.
If I only have one where clause, it works. (i.e. WHERE position_id = <cfqueryparam value="#arguments.posid#" cfsqltype="cf_sql_integer">).
If I remove the where clause from my subquery (WHERE item_id = department_staff_tbl.staff_id) it works.
It also works if I remove the cfqueryparam from my where clause so that my query looks like this:
SELECT department_staff_tbl.*,
( SELECT max(bookmark_id)
FROM bookmarked_items_tbl
WHERE item_id = department_staff_tbl.staff_id
) AS bookmark_id
FROM department_staff_tbl
WHERE department_id = #arguments.deptid#
AND position_id = #arguments.posid#
AND staff_id = #arguments.staffid#
Any thoughts?I see two tables. So can the server. So, use qualified column-names.
SELECT department_staff_tbl.*,
( SELECT max(bookmarked_items_tbl.bookmark_id)
FROM bookmarked_items_tbl
WHERE bookmarked_items_tbl.item_id = department_staff_tbl.staff_id
) AS bookmark_id
FROM department_staff_tbl
WHERE department_staff_tbl.department_id = <cfqueryparam value="#arguments.deptid#" cfsqltype="cf_sql_integer">
AND department_staff_tbl.position_id = <cfqueryparam value="#arguments.posid#" cfsqltype="cf_sql_integer">
AND department_staff_tbl.staff_id = <cfqueryparam value="#arguments.staffid#" cfsqltype="cf_sql_integer">
Maybe you are looking for
-
Can not unlock the purchase in the free game
can not unlock the purchase in the free game
-
Weird problem getting P965 Plat to post
So I recently inherited a pc from a friend that decided to move across the country... He said it's never worked after he put it together and he believed the mobo was to blame. So I do some bench testing with just cpu, video card and memory... and al
-
How do I turn off "find my iphone" from the computer? The phone was disabled and I cannot restore and back up until I turn off this feature
-
Flash Help in Spanish has wrong language (LNG)
Good day, I am using Adobe RoboHelp Version 7.00.45 on Windows XP. When I go in File - Project Settings - Language and I select spanish, I don't get a spanish LNG file, but another language. The other tabs in the project settings dialog (Stops list,
-
Hello. I've recently recorded some footage with my Canon T2i with a resolution of 1920x1080. I've taken all the footage (In .MOV format) and put them together to make a dvd in Encore CS5.5. I had to make my own menu, buttons, highlights and everythin