SQL Query returns values like "---" and "NA"
Hi
When I execute a sql query in MII it returns values like "---" and "NA" for empty Char and numeric fields respectively.
I have checked the database and made sure that these fields does not have any value. This happens only when I run the query through MII. Can any one know how can we get rid of these values?
Thanks in advance
Shaji
Shaji,
MII sets those values as a default if it discovers null values in a query result. You can change this default behaviour in several ways.
First, have a look at the document [Setting custom null values in XML|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70628af0-8ec4-2c10-7da2-f451e412dd8f?quicklink=index&overridelayout=true]. Then you may also use SQL functions like [NVL|http://www.techonthenet.com/oracle/functions/nvl.php] to change the value directly in the SQL query. You can also change the value inside the MII BLT to whatever you need.
Michael
Similar Messages
-
SQL query returns value but EXEC SQL Task fails to assign variable
I have an execute SQL task to get an identifier from an Oracle database and assign it to a variable (the variable is used in subsequent query's where clauses to transfer the data to a SQL Server database). If I copy the query from the SSIS
package to the Oracle SQL Developer interface and run the query; I get the expected single identifier. If I run the execute SQL task I get the error "[Execute SQL Task] Error: An error occurred while assigning a value to variable "VariableName":
"Single Row result set is specified, but no rows were returned."
I can create phony/simpler versions of the query that will return the wrong identifier that will successfully assign the value to the variable, so the problem isn't with the variable itself or the way the result set is set up in the task (Result
Set/Single Row in the General panel; Result Name 0/VariableName in the Result Set panel).
How can two queries that return a single value produce different results with respect to the variable assignment process?Perhaps you can trap (profile) the query in Oracle to see what it gets submitted,
thing is this query
select id from table where ProcessedStatusColumn is null and DateColumn = (sub select to get most recent date in table where ProcessedStatusColumn is null)
is not guaranteed to return a value, you need a default returned in case the search failed e.g.
select
NVL(id, 0)
from table where ProcessedStatusColumn is null and DateColumn =
(sub select to get most recent date in table where
ProcessedStatusColumn is null)
Arthur My Blog -
SQL Query-return current month and the same month of last year
hello-
I would like to display the current month name, count of errors, year, and month number for both current year and previous year. Having trouble getting my query to display as following.....
Month CountofErrors Year MoNo
January 57 2015 1
January 155 2014 1
thank you!Its hard to answer without DDL and DML and sample data.
Give a try
select DATENAME(month,getdate()),Month(getdate()),YEAR(getdate()) ,COUNT(*) from dbo.errortable
where DATENAME(month,getdate())='January' and YEAR(getdate()) in(YEAR(getdate()),YEAR(getdate())-1)
group by DATENAME(month,getdate()),Month(getdate()),YEAR(getdate())
--Prashanth -
SQL query returns varchar - default value type!!!
On a field in my portal form there is a default value type of 'SQL query returns varchar', where can I put this sql to get a default value from a table?
Hi again
I have this code in 'additional pl/sql code' - '...before displaying the page'. But it comes up with an error when I run the form.
declare
prop_v varchar2(20);
group_v varchar2(3);
el1_v varchar2(3);
blk varchar2(10) := 'DEFAULT';
begin
prop_v := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT', p_attribute_name => 'l_property_p');
group_v := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT', p_attribute_name => 'l_group_p');
select element_code
into el1_v
from eh_risk_element_detail
where property_ref = prop_v
and group_code = group_v
and line_no = 1;
p_session.set_value(p_block_name => blk, p_attribute_name => 'L_ELEMENT1_P', p_value => el1_v);
end;
Rich -
Sys_refcursor not fetching any data although query returns value
hi!!!
I am using sys_refcursor to return columns,and using below procedure to do so.Although data is there in table_1 and table_2.
PROCEDURE test_pro(abc_date N DATE,
cur_get_data OUT sys_refcursor
OPEN cur_get_data
for
select A.col1,B.col2
from table_1 A
where A.dis_date=abc_date
left outer join
table_2 B
on
A.dis_date=B.dis_date;
IF cur_get_data%rowcount=0
then
raise e_error;
END if;
EXCEPTION
when e_error
then
------no_data_found;
when others
then
--------(giving SQL error with error code);
END test_pro;
while running below sql in sql window of pl/sql developer fetching
data
select A.col1,B.col2
from table_1 A
where A.dis_date=abc_date
left outer join
table_2 B
on
A.dis_date=B.dis_date;
but while testing the test_pro in test window of pl/sql developer it is
not fetching any data and raising e_error each time
is there any problem arising using IF cur_get_data%rowcount=0 as each time it is going to exception block..
so can somebody please put some ideas what cud be the possible reason for this??Welcome to the forum!
Unfortunatley you posted to the wrong forum. This question belongs in the SQL and PL/SQL forum.
PL/SQL
>
sys_refcursor not fetching any data although query returns value
but while testing the test_pro in test window of pl/sql developer it is
not fetching any data and raising e_error each time
is there any problem arising using IF cur_get_data%rowcount=0 as each time it is going to exception block..
>
A cursor doesn't fetch data - your code has to do that. The code you posted doesn't have any FETCH statements so no data will be fetched.
There is no problem using 'IF cur_get_data%rowcount=0' but it will always be 0 in your code because you are not fetching any data.
I'm guessing that you are trying to determine if there are any rows for the query. That isn't going to work since a cursor doesn't fetch rows.
You just have to return the cursor to the caller and the caller will have to perform at least one fetch to see if there are any rows.
If the above answers your question the just mark the question ANSWERED. Otherwise, since you have posted in the wrong forum
1. repost the question in the SQL and PL/SQL forum
2. Edit this post to add a link to the new thread in the other forum
3. Mark this question ANSWERED so people will follow up in the other forum.
Thanks. -
Creating a directory via a jsp page sql query return
Is it possible to create a directory based on the results of a sql query?
i.e.
My sql query returns application number 1234 for a building application (BC for short).
Is it possible to create a directory /BC/1234
It is then proposed to use an iframe to look into the directory so users can place and access scanned documents which are captured during the approval process.
If so how?
An example would be great.
JasonSorry hope your still around I've been away for a while. We've created a samber share to the file server where the documents are stored and mounted it within the web file directory. It works ok if there is an existing directory but if there isn't we want it to be created when the page looks for the folder. I've done this with an asp page it basically did a directory exist test first then create folder if it didn't. The problem is can't find an example of how to do the directory exist test then directory create syntax so an example of both would be great
-
Hi in my sql query i applied like condition (like '%TEST') but it is taking long time. I applied indexes also,but still i'm facing the same problem. In my databse nearly 2,00,000 records their.
Hi Manikandan
Is there a difference in performance between running the query in BEx and WebI?
have you aggregates in place on the BEx side of things?
When you say its taking too long to open the report, have you a variable screen coming up for the report and is that what is taking the time or is it the report execution.
With regards
Gill -
Need to run a sql query in the background and display the output in HTML
Hi Guys,
I have a link in my iprocurement webpage, when i click this link, a query (sql query) should be run and the output should be displayed in a HTML page. Any ideas of how this can be done. Help appreciated.
We dont have OA Framework and we r using 11.5.7.
help needed
thanxRead Metalink Note 275880.1 which has the link to developer guide and personalization guide.
-
APEX,PDF's, BI Publisher and SQL Query returning SQL code..
I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
Here is my dilemma:
I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
Thank you,
Tony Miller
UTMB/EHN
Title adjusted to allow people to know what I am talking about...
Message was edited by:
Tony MillerTony,
You can find the log as follows:
- go to http://[yourserver]:[yourport]/em
- logon to OC4J EM: oc4jadmin/[yourpassword]
- click on "logs" at the bottom of the page
- in the hgrid/tree, expand OC4J->home->Application
xmlpserver
- click on view log icon
You can also observe what's going on in BI Publisher
by going to the command prompt from where you started
it.
Or, as a third option, you can locate the file on
your file system, depending on your setup, the path
would be something similar to this:
\oracle\product\10.2.0\bip\j2ee\home\application-deplo
yments\xmlpserver\application.log
With that said though, I don't expect you'll find
much in there that would help with your particular
problem. I suspect you either get no rows in your XML
at runtime, due to some session state issues, or your
XML structure does in fact not match your RTF
template.
I'm not quite following your problem description,
i.e. when did you do what and are you associating
your report layout with a report query or report
region. So just some general notes, your query needs
to be parseable at design-time, when exporting the
XML, so that you get the XML file with the proper
column names derived from your query. If you want to
use your RTF template with a standard report region,
you must export the XML file first using the advanced
XML structure option. And of course the column names
in your report query need to match the column names
in your report region.
Perhaps this helps you further diagnose what's going
on, if you have additional information that could
help, let me know. And if you could stage this on
apex.oracle.com, I'd be happy to take a look.
Regards,
MarcMarc,
Thanks for looking at this issue. Below find my remarks to your questions..
Re: your query needs
to be parseable at design-time, when exporting the
XML, so that you get the XML file with the proper
column names derived from your query.At the start of this process, the query code was a function in a package. The function was returning an SQL select statement, for a report region on a page. I took the select statement, built an application query to build a sample of the xml for BI Publisher desktop (Add-on for Word). The code was producing the usual Col01, Col02.. since at design time that is were the column names.
When I then took the xml from this and built the rtf for loading into my APEX application.
When testing the Application Query with this RTF report layout, I am getting PDF's. When using it with the report region sending an xml feed to BI Publisher I am getting nothing back.
I have since taken the sql code and moved it back into the report region, and set the region to have a type of straight SQL Query. I have even tried to hard-code the parameters I was getting from the page to limit data returned.
Is it possible to see the xml being produced by the APEX page?
Re: Stage this on apex.oracle.com.. I would love to, but we would have HIPPA issues if I posted the data on a public website.
Can I send you the RTF file and the xml file that the application query is creating to see if there something weird about them?
Thank you,
Tony Miller
UTMB/EHN -
hi Experts,
while running SQL Query i am getting an error as
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query
select T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
T2.LineText
from OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
QUT10 T2 ON T1.DocEntry = T2.DocEntry where T1.DocEntry='590'
group by T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
,T2.LineText
how to resolve the issueDear Meghanath,
Please use the following query, Hope your purpose will serve.
select T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
CAST(T2.LineText as nvarchar (MAX))[LineText]
from OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
QUT10 T2 ON T1.DocEntry = T2.DocEntry --where T1.DocEntry='590'
group by T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
,CAST(T2.LineText as nvarchar (MAX))
Regards,
Amit -
SQL Query returns question marks
I am seeing a SQL Query, executed via ADODB in VB, from a 10G client (don't know exact version) to a Sun Solaris based 9.2.0.5.0 Server return all question marks...Table queried consists of 3 columns, 2 varchar2, one long: Here query:
SELECT SETTINGVALUE FROM EWORKFLO.CONFIG WHERE SETTINGGROUP='New test' AND SETTINGNAME='Single Page'
The query results in 2576 question marks...(????? etc).
Any idea what may be going on here?
Thanks...
LeendertHello Tak,
Thanks for replying. When this query is run from SQLPLUS we get a proper result back, that is the actual values from the SETTINGVALUE column. This is the LONG column and contains data like this:
[Scan Section]
DeviceTimeout=15
Display=1
hDCCreate=0
Unit=0
DialogTitle=
IniFileName=c:\winnt\temp\kf.ini
IniSectionName=Scan Section
DeviceCache=1
etc....etc....
Depending on the settings created, the return string may vary in length.
Leen -
SQL query using Group by and Aggregate function
Hi All,
I need your help in writing an SQL query to achieve the following.
Scenario:
I have table with 3 Columns. There are 3 possible values for col3 - Success, Failure & Error.
Now I need a query which can give me the summary counts for distinct values of col3 for each GROUP BY of col1 and col2 values. When there are no values for col3 then it should return ZERO count.
Example Data:
Col1 Col2 Col3
abc 01 success
abc 02 success
abc 01 success
abc 01 Failure
abc 01 Error
abc 02 Failure
abc 03 Error
xyz 07 Failure
Required Output:
c1 c2 s_cnt F_cnt E_cnt (Heading)
abc 01 2 1 1
abc 02 1 1 0
abc 03 0 0 1
xyz 07 0 1 0
s_cnt = Success count; F_cnt = Failure count; E_cnt = Error count
Please note that the output should have 5 columns with col1, col2, group by (col1,col2)count(success), group by (col1,col2)count(failure), group by (col1,col2)count(error)
and where ever there are NO ROWS then it should return ZERO.
Thanks in advance.
Regards,
ShivaHi,
user13015050 wrote:
Thanks TTT. Unfortunately I cannot use this solution because I have huge data for this.T's solution is basically the same as mine. The first 23 lines just simulates your table. Since you actually have a table, you would start with T's line 24:
SELECT col1 c1, col2 c2, SUM(decode(col3, 'success', 1, 0)) s_cnt, ...
user13015050 wrote:Thanks a lot Frank. It helped me out. I just did some changes to this as below and have no issues.
SELECT col1
, col2
, COUNT ( CASE
WHEN col3 = 'SUCCESS'
THEN 1
END
) AS s_cnt
, COUNT ( CASE
WHEN col3 = 'FAILED'
THEN 1
END
) AS f_cnt
, COUNT ( CASE
WHEN col3 = 'ERROR'
THEN 1
END
) AS e_cnt
FROM t1
WHERE c2 in ('PURCHASE','REFUND')
and c4 between to_date('20091031000000','YYYYMMDDHH24MISS') AND to_date('20100131235959','YYYYMMDDHH24MISS')
GROUP BY c1, c2
ORDER BY c1, c2;
Please let me know if you see any issues in this query.It's very hard to read.
This site normally compresses spaces. Whenever you post formatted text (such as queries or results) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
Also, post exactly what you're using. The code above is SELECTing col1 and col2, but there's no mention of either in the GROUP BY clause, so I don't believe it's really what you're using.
Other than that, I don't see anything wrong or suspicious in the query. -
I just wanted to note this on the forum..
I'm using Apex 3.0.1.00.08
My DEV environment has just been upgraded from 10g version 10.2.0.2.0 to 10.2.0.4.0.
I created the following process to select some values into some items on my Form page.
select MAX(STAT_YEAR+1)
, pcd.pct_id
, pcd.stat_type_id
, pcd.stat_period_type_id
, pcd.measurement_id
into :P11_STAT_YEAR
, :P11_PCT_ID
, :P11_STAT_TYPE_ID
, :P11_STAT_PERIOD_TYPE_ID
, :P11_MEASUREMENT_ID
from plant_commodity_data pcd
, stat_type stt
where pcd.STAT_TYPE_ID = stt.STAT_TYPE_ID
and pcd.pct_id = :P0_PCT_ID
and stt.stat_type = 'PRD'
group by pcd.pct_id
, pcd.stat_type_id
, pcd.stat_period_type_id
, pcd.measurement_id;The process should run conditionally if there was at least one row to select...
So I copied the SQL into the Process condition, removed the "into" section and set the condition type to be "Exists (SQL query retruns at least one row) ...
select MAX(STAT_YEAR+1)
, pcd.pct_id
, pcd.stat_type_id
, pcd.stat_period_type_id
, pcd.measurement_id
from plant_commodity_data pcd
, stat_type stt
where pcd.STAT_TYPE_ID = stt.STAT_TYPE_ID
and pcd.pct_id = :P0_PCT_ID
and stt.stat_type = 'PRD'
group by pcd.pct_id
, pcd.stat_type_id
, pcd.stat_period_type_id
, pcd.measurement_id;This worked perfectly until the DEV environment was upgraded from 10g version 10.2.0.2.0 to 10.2.0.4.0.
The condition would fire even if there were no rows returning.
I pasted the condition code into SQL Developer connected to the DEV (10.2.0.4.0) environment and it returned no rows.
To solve the problem, I removed the MAX.
You can test this using this code if you have access to the two versions... select MAX(1)
, sysdate
, 'Gus'
from dual
where 1 = 2
group by sysdate, 2Now I know the MAX isn't required in the condition as I'm just trying to find out if any rows exist, but it was there as I copied the code in... I was just wondering why this happened between 10.2.0.2.0 and 10.2.0.4.0?
Gus..Hi Gus,
try to execute
select count(*) from dual where exists (select MAX(1)
, sysdate
, 'Gus'
from dual
where 1 = 2
group by sysdate, 2)in SQL Developer. The above statement is generated by APEX for an "Exists (SQL query retruns at least one row)". Can't test it, because I don't have a 10.2.0.4.0 at hand.
Does SQL Developer now show the same behavior?
Patrick
My APEX Blog: http://www.inside-oracle-apex.com
The APEX Builder Plugin: http://builderplugin.oracleapex.info/
The ApexLib Framework: http://apexlib.sourceforge.net/ -
Using a SQL Query in an Alert and Matching a String
I've created an alert in 12.0.4 using a SQL Query and the field that I'm trying to match is a string. Originally the query returned multiple rows but when the alert still didn't fire, I modified the query WHERE clause to return only one row:
NAME RESPONSE
Are area lights working? No
My expression in the metric is RESPONSE. In the Monitor I'm matching a string equal to No. (Do I need double quotes around the matchvalue? Single quotes? No quotes?) The metric is in the 15min scan group, the role is xMII Developers and I'm in that role. The monitor alert string is ' = '. Both metric and monitor are active and I've subscribed to the monitor. Other alerts in the 15min scan group (all based on tag queries) are firing off properly.
Why is nothing showing up in the Alert Log?
David MacindoeDavid,
Did you figure out the answer? If not, I will try to find someone to address your question.
Mike -
Sql query to seperate character and number data in a column
Hi,
We have a test table on 10.2.0.4 db as below;
10:44:34 TEST:WAULT > desc t;
Name Null? Type
EMP VARCHAR2(10)
10:43:18 TEST:WAULT > select * from t;
EMP
JOHN
7281
TOM
7852145
BNPPARIBAS
9862354
Mindcraft
875
INFINITY
78998775
01234
EMP
0
-123
-856359
SCOTT
-657
16 rows selected.
The question is; we need to segregate the character data and numerical data in the EMP field, using sql query.
Plz suggest as to how we can achieve this.
Also, plz suggest how the use of reqexp can be made in this to achieve the same.
Thanks,
Rahul>
Hi,
EMP
JOHN
7281
TOM
7852145
The question is; we need to segregate the character data and numerical data in the EMP field, using sql query.
Plz suggest as to how we can achieve this.Check out the CAST function
http://download.oracle.com/docs/cd/B12037_01/server.101/b10759/functions015.htm
However, I would have to ask why on earth you're doing this - it would, IMHO, be
much better to redesign your app. It looks like you have an EAV problem
(AKA MUCK or OTLT) Google Joe Celko and these terms.
Paul...
Rahul
Maybe you are looking for
-
Has anybody figured out how to make flip4mac work in Lion? I get sound but no picture
WMV files have worked fine up through snow leopard but now all I get is audio and no video. Have reinstalled newest version of flip4mac but same results
-
When this occurs the browser tends to hang for a few seconds and no other tabs can be selected. I have tried uninstalling firefox and reinstalling. I have the latest version of firefox (3.6.3) == URL of affected sites == http:// - all sites
-
Hi! I have been having this issue recently of new tabs and windows opening constantly on my MacBook whenever I click on whatever website. I mean, even when I was trying to write the question to post on this forum, a new window popped and opened in th
-
I modified the connection pool to connect to development database. Of course, I stopped the presentation and the BI servers before making any change to RPD. After restarting the services, I was able to connect to Dev DB. However, a few minutes later,
-
I copied ipad icons onto my windows desktop how do I remove them?
My dad was trying to add an icon to his desktop and managed to copy about 12 ipad icons onto his desktop and I can't remove them for him. They are large and don't respond to the cursor. I looked in desktop but they aren't listed. I renamed them a tex