Displaying a column in report which returns null value
Hi
I have a simple report with two column. The query is as below.
SELECT decode(caste,1,'SC/ST',2,'General','3','PWD') fcastepi, nvl(count(*),0) fcapi
FROM applicationformdtl
WHERE year = :p_year
AND selected = 1
AND PROGCD = 'PRM'
GROUP BY caste
This query returns values for SC/ST and General as there is no matching data for the PWD. But I want to display PWD with value 0 in the report. How to do this? Can anyone help me in this matter at the earliest?
Regards
Trusha
hello,
u r calculating the cast in ur detail table applicationformatdtl.
and also u have the table of caste in which caste description is given
so ur query like this
select nvl(decode(a.caste,1,'sc/st',2,'general'),'pwd')cast,
nvl(a.caste,40),decode(count(*),1,0,count(*),count(*)) total
from applicationformdtl a,caste c where c.caste = a.caste(+) group by a.caste
which gives the output
caste total
sc/st 3
general 5
pwd 0
bye
Chandan
Similar Messages
-
Can we add a new column in report which is not in table.
Hi All,
Can we create a new column in report which is not in table.
I have two columns in my table completion_date, manufacture_date. If the difference between the completion_date and manufacture_date is 0, -1, 1 then the new column of the report will say on time against each record or else will display late. Any suggestion how to proceed on this
Regards
Edited by: User_Apex on May 16, 2011 5:54 AMStandard report then, NOT an interactive report (which if you were using, you could build a computation and report on that)..
Then the adding a column in the query would be your best best...
Thank you,
Tony Miller
Webster, TX
There are two kinds of pedestrians -- the quick and the dead.
If this question is answered, please mark the thread as closed and assign points where earned.. -
Function which returns multiple values that can then be used in an SQL Sele
I'd like to create a function which returns multiple values that can then be used in an SQL Select statement's IN( ) clause
Currently, the select statement is like (well, this is a very simplified version):
select application, clientid
from tbl_apps, tbl_status
where tbl_apps.statusid = tbl_status.statusid
and tbl_status.approved > 0;
I'd like to pull the checking of the tbl_status into a PL/SQL function so my select would look something like :
select application, clientid
from tbl_apps
where tbl_apps.statusid in (myfunction);
So my function would be running this sql:
select statusid from tbl_status where approved > 0;
... will return values 1, 5, 15, 32 (and more)
... but I haven't been able to figure out how to return the results so they can be used in SQL.
Thanks for any help you can give me!!
Trisha GorrPerhaps take a look at pipelined functions:
Single column example:
SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
2 /
Type created.
SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
2 l_idx PLS_INTEGER;
3 l_list VARCHAR2(32767) := p_list;
4 l_value VARCHAR2(32767);
5 BEGIN
6 LOOP
7 l_idx := INSTR(l_list, p_delim);
8 IF l_idx > 0 THEN
9 PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
10 l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
11 ELSE
12 PIPE ROW(l_list);
13 EXIT;
14 END IF;
15 END LOOP;
16 RETURN;
17 END SPLIT;
18 /
Function created.
SQL> SELECT column_value
2 FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
COLUMN_VALUE
FRED
JIM
BOB
TED
MARK
SQL> create table mytable (val VARCHAR2(20));
Table created.
SQL> insert into mytable
2 select column_value
3 from TABLE(split('FRED,JIM,BOB,TED,MARK',','));
5 rows created.
SQL> select * from mytable;
VAL
FRED
JIM
BOB
TED
MARK
SQL>Multiple column example:
SQL> CREATE OR REPLACE TYPE myrec AS OBJECT
2 ( col1 VARCHAR2(10),
3 col2 VARCHAR2(10)
4 )
5 /
Type created.
SQL>
SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
2 /
Type created.
SQL>
SQL> CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
2 v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
3 v_obj myrec := myrec(NULL,NULL);
4 BEGIN
5 LOOP
6 EXIT WHEN v_str IS NULL;
7 v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
8 v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
9 IF INSTR(v_str,',')>0 THEN
10 v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
11 v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
12 ELSE
13 v_obj.col2 := v_str;
14 v_str := NULL;
15 END IF;
16 PIPE ROW (v_obj);
17 END LOOP;
18 RETURN;
19 END;
20 /
Function created.
SQL>
SQL> create table mytab (col1 varchar2(10), col2 varchar2(10));
Table created.
SQL>
SQL> insert into mytab (col1, col2) select col1, col2 from table(pipedata('(1,2),(2,3),(4,5)'));
3 rows created.
SQL>
SQL> select * from mytab;
COL1 COL2
1 2
2 3
4 5 -
How to check the sql:query is return null value
I have use :
<sql:query var="sql1" dataSource="${db}">
select col_name from table_name
where a=<c:out value="${row.test1}"/>
and b='<c:out value="${row.test2}"/>'
</sql:query>
So, how can I check this statement return null value which is no record within this table?The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
<sql:query var="books"
sql="select * from PUBLIC.books where id = ?" >
<sql:param value="${bookId}" />
</sql:query>
<c:if test="${books.rowCount > 0}">
</c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
Look for query Tag Result Interface -
Reading User Profile Properties pragmatically in SharePoint 2010 Returns Null Values Although it has values returned from AD
I configured the user profile service application and run Sync and user profiles and its properties returned from Active directory but when I want to read it pragmatically it returns null values.
this is my code...
void runQueryButton_Click(object sender, EventArgs e)
// Get the My Sites site collection, ensuring proper disposal
using (SPSite mySitesCollection = new SPSite("http://sp/my"))
//Get the user profile manager
SPServiceContext context = SPServiceContext.GetContext(mySitesCollection);
UserProfileManager profileManager = new UserProfileManager(context);
UserProfile profile = profileManager.GetUserProfile("Contoso\\user");
foreach (Property prop in profileManager.Properties)
// if (prop.Name == "Department")
resultsLabel.Text += prop.DisplayName + ":" + profile[prop.Name].Value + "<br />"; ;Hi,
Please try with the following code
PrincipalContext principalContext = new PrincipalContext(ContextType.Domain);
SPServiceContext context = SPServiceContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
foreach (Property prop in profileManager.Properties)
// if (prop.Name == "Department")
resultsLabel.Text += prop.DisplayName
+ ":" + profile[prop.Name].Value + "<br />"; ;
Thanks,
Vivek
Please vote or mark your question answered, if my reply helps you -
Calling a stored procedure which returns a value
Hi Friends,
I want to call a stored procedure which returns a value.
Eg
create or replace procedure xyz(a1 in varchar2, a2 in varchar2, z1 out number)
thanksHi,
use this.
declare
retval number;
begin
abc('aaa','bbb',retval);
dbms_output.put_line('retval is ' ||retval);
end;
--Basava.S -
Call plsql procedure from ADFBC which returns a value.
Hi All,
I want to call one of my SQL Procedures which returns 4 values after execution from my AMImpl file.
The code snippet on how I am trying to call the procedure is below, but I am in need of how to fetch the return value of the procedure once its executed.
public void callPlSql(String firstParm, String secondParm) {
CallableStatement s = this.getDBTransaction().createCallableStatement("BEGIN my_pl_sql_procedure(?, ?); END;", 0);
try {
s.setString(1,firstParm);
s.setString(2,secondParm);
s.execute;
} catch (SQLException e) {
throw new JboException(e);
any idea how to get hold of the return values from the executed procedure ?
Thanks
TKafter you executed the procedure, you can get the output based on their type and index
public void callPlSql(String firstParm, String secondParm) {
CallableStatement s = this.getDBTransaction().createCallableStatement("BEGIN my_pl_sql_procedure(?, ?); END;", 0);
try {
s.setString(1,firstParm);
s.setString(2,secondParm);
s.execute;
e.getDate(index of your output);
e.getInt(index of your output);
e.getString(index of your output);
} catch (SQLException e) {
throw new JboException(e);
}you can also check this:
http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvgen.htm#sm0458 -
Return the column names for which the row values are not null.
Hi i m a new guy to db admin, and i need a sql script which should return column names of the particular table. and the returned column should have value (fyi - if the column has null value column name should not come in the sql o/p).
Exmple:
table name - A
s.no name mark status fee
1 aa 45 p null
2 bb 30 null paid
3 cc 35 p paid
fyi -1) if i give the table name(A) and s.no (2) the o/p should be -- name,mark.
2) if i give the tablename(A) and s.no (1) the o/p should be --- name,mark,status.
Thanks
Krishna.
Edited by: user13294228 on Jun 14, 2010 10:54 PMBTW,
The previous solution is for all values of the column, if you want a specific row, you can add it in where clause.
I mean in your example, it you look like:
SET serveroutput on;
DECLARE
l_cnt NUMBER;
l_str VARCHAR2 (255) := '';
l_table_name VARCHAR2 (255) := 'YOUR_TABLE_NAME';
l_col_cond VARCHAR2 (255) := 'S_NO';
l_val NUMBER := 1;
CURSOR c_col
IS
SELECT column_name
FROM user_tab_columns
WHERE table_name = l_table_name;
BEGIN
FOR i IN c_col
LOOP
EXECUTE IMMEDIATE 'SELECT COUNT ('
|| i.column_name
|| ') FROM '
|| l_table_name
|| ' WHERE '
|| l_col_cond
|| ' = '
|| l_val
INTO l_cnt;
l_str := l_str || CASE
WHEN l_cnt = 0
THEN ''
ELSE i.column_name
END || ',';
END LOOP;
l_str := SUBSTR (l_str, 1, LENGTH (l_str) - 1);
DBMS_OUTPUT.put_line (l_str);
END;Saad,
Edited by: S.Nayef on Jun 15, 2010 11:54 AM -
Varchar Column Returning Null Value
Hi
I have a report with a subquery which contains a dynamic from clause which is set by the main query, the report returns date and number values from the view in the subquery but does not return varchar2 values, if I select the varchar2 values from the view in sqlplus then the value is returned.
Any help would be much appreciated thanks,
DereckPlease check the elasticity of the field in the Report Layout where you are returning the varchar2 value.
-
Web Service Operation returns null values
I got a Flash program that uses a Web Service. I linked the actionscript to the Flex Files to get my connection to work. I got it to work fine, but the problem is with sending it parameters. This only works on functions without parameters. But when I try to pass parameters, it returns null. I also tried using the argruments function, but that caused it to return error. What do I do to make it work? Here is my code below:
stop();
import flash.display.MovieClip;
import flash.events.MouseEvent;
import mx.rpc.soap.*;
import mx.rpc.events.*;
import mx.rpc.AbstractOperation;
import flash.events.Event;
import flash.utils.Timer;
var webService:WebService = new WebService();
webService.wsdl = "http://www.askent.com/ttcs.asmx?WSDL";
webService.loadWSDL();
var serviceOperation:AbstractOperation;
/*var loginTimer: Timer = new Timer(1000, 1);
loginTimer.start();*/
var loginOperation: AbstractOperation;
var nickname:String;
var token:String = "token";
var gameName:String = "CRAZ";
//loginTimer.addEventListener(TimerEvent.TIMER, SetupWebService);
signin_btn.addEventListener(MouseEvent.CLICK, login);
/*function SetupWebService(event: TimerEvent):void{
webService.loadWSDL("http://www.askent.com/ttcs.asmx?WSDL");
webService.addEventListener(LoadEvent.LOAD, BuildServiceRequest);
function BuildServiceRequest(evt:LoadEvent){
/*loginOperation = webService.getOperation("GuestLogin");
loginOperation.send(nickname, token, gameName);
//nickname = name_input.text;
loginOperation.addEventListener(FaultEvent.FAULT, DisplayError);
loginOperation.addEventListener(ResultEvent.RESULT, DisplayResult);*/
trace("connected");
function login(event: MouseEvent): void{
loginOperation = webService.getOperation("GuestLogin");
//nickname = name_input.text;
loginOperation.addEventListener(FaultEvent.FAULT, DisplayError);
loginOperation.addEventListener(ResultEvent.RESULT, DisplayResult);
//loginOperation({Nickname: nickname, Token: token, GameName: gameName});
//loginOperation.arguments = {nickname: "GGG", Token: "token", GameName: "gameName"};
loginOperation.send([nickname, token, gameName]);
function DisplayError(evt:FaultEvent){
trace("error");
function DisplayResult(evt:ResultEvent)
var wsdlResponse:String = evt.result as String;
trace(wsdlResponse);
function sendLogin(nickname: String, token: String, gameName: String): String{
return nickname + token + gameName;Shay,
The link worked. I generated Java Web Service from my WSDL, and tested using the HTTP analyzer
But for get Operation method on the WSDL, I could not see anything in the response object, but the same operation i could see the output in soapUIPro.
Can you give me some more guildelines to debug...
Thanks,
Sri -
Webservice returns null values (Flex)
Hi all,
I created a webservice in abap,
(a RFC and a Function Web Service).
It exports a table type and contains data from a Ztable.
When i request it from Flex, it returns rows, but they contain NULL values, why ?
I can request and display bapi webservices that comes with in SapNetweaver trial 7.1 but i cant display my own webservice.
Result like this;
result generated.webservices.ZCUSTOMERS_TT (@2205981)
[inherited]
[0] generated.webservices.ZCUSTOMERS (@2362c91)
CLIENT null
ID null
NAME null
[1] generated.webservices.ZCUSTOMERS (@23a4129)
[2] generated.webservices.ZCUSTOMERS (@23a42e1)
[3] generated.webservices.ZCUSTOMERS (@23a41c9)
it is true that there are 4 rows in table, but all client, id and name is null
why ?thanks for answer but my problem didint solved.
My webservice can return normal values like integer or decimal and i can read it from flex.
but when i try to view tables, i always get null values BUT item count is true :=) i have 4 item in z table and 4 rows returns in array from webservice but NULL values :=).
I can't return structure as well.
result mx.utils.ObjectProxy (@211af29)
DEGER 1
GS_CUSTOMER generated.webservices.ZCUSTOMERS (@22ce719)
CLIENT null
ID null
NAME null
GT_CUSTOMER mx.collections.ArrayCollection (@210cd01)
[inherited]
[0] generated.webservices.ZCUSTOMERS (@22cef61)
CLIENT null
ID null
NAME null
[1] generated.webservices.ZCUSTOMERS (@22ced31)
[2] generated.webservices.ZCUSTOMERS (@22cedd1)
[3] generated.webservices.ZCUSTOMERS (@22cea11)
source Array (@22687e9)
object Object (@22ce8a9)
type null
uid "723117ED-66EC-C93B-9E66-C0FD4F01246C"
ZCUSTOMER_TT generated.webservices.ZCUSTOMERS_TT (@22eb941)
What do you use, when declaring variables ?
Like or type or ref to ? Can it be a problem ?
here is my function export inteface.
http://img241.imageshack.us/img241/9258/screenhunter01jun082052.gif
Edited by: bilen cekic on Jun 8, 2009 8:26 PM -
Binding for "File Content Repository Path" is returning null value
I have created a data control for file based content repository based on an existing file system path. *But when this data contol is invoked the command "#{bindings['getURI_returnURI'].inputValue}" is returning null.*+
Please advice what are possible scenarios. I have performed the following
#1. Create a file system folder in windows XP named "C:\CPContentRepository" and add some html pages into this folder.
#2. Create a "content" project in the application.
#3. Create a "Content Repository Data Control" named "CPFileContentRepository". Repository Type : "File System", Base Path : "C:\CPContentRepository". Test & Registration is successful.
#4. Add a "panel horizontal" into jsf jsp "ContentTest" page & drap-dop data control "CPFileContentRepository--> getURI(String)--> Return--> URI". select return type as "ADF Output Text".
#5. Edit Authorization of the "ContentTest" page definition for "View --> anyone".
#6. Edit Authorization of the "ContentTest" page definition bindings "getURI" for "Invoke --> anyone".
#7. Run the "ContentTest" page. The output for the page is empty.
Regards,
VikkiThere're two major problems in your code. One you have used different names to get your parameters like in your first jsp they're like
<input type="text" name="did" size="20" </p>
<p align="center"> </p>
<p align="center"><b>Name </b>
<input type="text" name="name" size="20"></p>
<p align="center"> </p>
<p align="center"><b>Specialist In
<input type="text" name="specialist" size="20"></b></p>
<p align="center"> </p>
<p align="center"><b>Address
<input type="text" name="address" size="20"></b></p>
<p align="center"> </p>
<p align="center"><b>Phone no.
<input type="text" name="phno" size="20"></b></p>
<p align="center"> </p>but when you're getting you're doing it like this
String name = request.getParameter("name");
String did = request.getString("did");
String add = request.getParameter("add");
String specilist = request.getParameter("specilist");
String phno = request.getParameter("phno");First get them with same name as you have them in your first jsp. another thing in that you're not used form tag in write way... You have created submit button in some other form
and when you're pressing submit button actully you're submitting only that form value and your form1 is not submitted that's why you're getting null values for
those parameters you're getting with right name -
Component binding return null value
I'm migrating a JSF 1.2 application to JSF 2.1, specificly I'm currently using mojorra 2.1.24.
The application consists of request scoped beans, and in order to pass data between requests, it embeds the data inside UI components.
The following behaviour works well with JSF 1.2, but not with JSF 2.1.
The application has the following configuration:
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
The page contains the following snippet:
<h:form prependId="false">
<h:inputHidden binding="#{bean.inputHidden}" />
<h:panelGroup rendered="#{bean.rendered}">
<h:commandLink value="onAction" action="#{bean.onAction}" />
</h:panelGroup>
</h:form>
The bean is the following:
@ManagedBean
@RequestScoped
public class Bean {
private UIInput inputHidden;
private AItem item;
public setInputHidden(UIInput inputHidden){
this.inputHidden = inputHidden;
if(item != null){ this.inputHidden.setValue(item); }
public AItem getItem(){
return (AItem) getInputHidden().getValue();
// other getter/setter
public String onNavToPage(AItem item){ this.item = item; return "page"; }
public String onAction(){ //... do something return ""; }
public boolean isRendered(){ return getProcessItem() != null; }
The steps are the following:
to navigate to page page the method bean.onNavToPage is invoked from within another page;
upon page rendering the bean.item is set as bean.inputHidden value;
after the page is diplayed, the command link is pressed.
At this point no command link is invoked, because the bean.inputHidden.getValue() returns null, and the command link is not processed.
I noticed that the inputHidden parameter passed to the setInputHidden method during restore view phase has, inputHidden.getValue() == null, no value has been saved previously in the view.
I would guess that something has changed in the component state management, but debugging the JSF code I didn't find what.
Debugging JSF code I found that the component state has been masked before the state has been saved in the view, so the ComponentStateHelper.saveState saves the deltaMap and not the defaultMap, where all the state has been put.
public Object saveState(FacesContext context) {
if (context == null) {
throw new NullPointerException();
if(component.initialStateMarked()) {
return saveMap(context, deltaMap);
else {
return saveMap(context, defaultMap);
is this a bug?
If not, how can I restore JSF 1.2 behaviuor and save the defaultMap?
Thanks in advance for the help.0.10: Saved session state: 6385226710016200 "P327_OU_NAME" changedValue="test"
0.10: ...P327_FK_ORGUNIT session state saving same value: "%null%"
0.15: Saved session state: 6388922235040486 "P327_OU_DESC" changedValue=""
0.15: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
0.15: Branch point: BEFORE_COMPUTATION
0.15: Computation point: AFTER_SUBMIT
0.15: Perform Branching for Tab Requests
0.15: Branch point: BEFORE_VALIDATION
0.15: Perform validations:
0.16: Branch point: BEFORE_PROCESSING
0.16: Processing point: AFTER_SUBMIT
0.16: ...PLSQL (AFTER_SUBMIT) INSERT INTO INDIT_PS_ORGUNIT ( OU_ID, FK_ORGUNIT, OU_NAME, OU_DESC ) VALUES ( INDIT_PASS_SEQ_GENERIC_ID.NEXTVAL, :P327_FK_ORGUNIT, :P327_OU_NAME, :P327_OU_DESC )
0.16: Show ERROR page...
0.17: Processing point: AFTER_ERROR_HEADER
0.18: Processing point: BEFORE_ERROR_FOOTER
ORA-01722: invalid number
the table was created with:
CREATE TABLE INDIT_PS_ORGUNIT (
OU_ID NUMBER(15) PRIMARY KEY,
FK_ORGUNIT NUMBER(15) NULL,
OU_NAME VARCHAR2(30) NOT NULL,
OU_DESC VARCHAR2(30) NULL,
OU_DELETED DATE NULL
what i see is that the status is "%null%" and not really "" (NULL, nothing, ...).
so what can i do to insert a null value from a select list?
i gave up RTFM. because i found nothing (NULL) ?!?! -
Displaying a column in report dynamically
I have a report where under one condition I need to have an additional column displayed in the report data sent to Excel. I have tried to add a lexical value in the select and in the BeforeReport trigger set it to the column needed or not.
This does not seem to be working.
Any suggestions would be appreciated.
Thank You.
Tom VereeckeIn the properties(ConditionalFormating) of the colum; you can add the condition that you want to evaluate.
I Hope you find this useful. -
Problem in Displaying More Columns in report
Dear all,
I have one report to display, currently it displays 23 different columns...upto horizontol position of 400.
Now I want to add 8 more columns , I have done coding accordingly ..
But output does not show additional columns after position 400. *
Please suggest me the possible suggestion............
ThanksHi,
You can try below code :-
REPORT ZTEST LINE-SIZE 400 ( or even more) NO STANDARD PAGE HEADING.
Hope it will help.
Maybe you are looking for
-
T450s - pci data acquisition and signal processing controller
I am installing a fresh build of win 8.1 and I cannot seem to find this driver. Anyone know what this is?
-
Designer v 8.2.1 will not do a Preview.
Designer v 8.2.1 will not do a Preview. It used to when my adobe reader was v7.5 then I installed adobe reader v9 and no I get this message. "The Adobe Acrobat/Reader that is running can not be used to view PDF files in a web browser. Adobe Acrobat /
-
K9VGM-V network adapter information
I just bought a K9VGM-V and i wanted to connect my old computer to it via ethernet to get my old files. anybody know if the network adapter with k9vgm-v support auto mdi /mdix? otherwise , i might need to get a crossover cable since i only have ordin
-
IFS support in Oracle 8i availability
Oracle XML Team wrote (in an earlier thread): : iFS has not yet been released. It is due to be released in : beta : at the end of June and go into production with the first : maintenance release of 8i (8.1.6). : Oracle XML Team : http://technet.oracl
-
sir, I have installed oracle 8i personal in my pc. now I want to deinstall it, how can I remove completely , it is not showing the oracle if I open add/remove programs. If I remove physically from the folder, the registry it shows the intalled oracle