Whitespace in xml result from SQL Utility
We're currently using the XML SQL Utility (ver XSU12, 8.1.7 database) with PL/SQL. We're able to successfully retrieve XML based result from the database.
However, almost a fourth of the document that's returned from the utility in CLOB is whitespace, which is not necessary in our application. Is there any way we can suppress this whitespace, so that the resulting document trasferred over the network is kept the smallest possible.
Thanks in advance
Murthy Jarugumilli
Use one of the XPath string functions. I don't have my reference book here but the one you want is called something like normalize-text, so look it up in your reference. Your element would then look something like this:
<xsl:value-of select="/results/record[normalize-text(id)=12]"/>
Similar Messages
-
Getting XML result from Oracle request
We have Oracle 8i Entreprise Edition and We like to get XML result from an Oracle request. Can I use only Oracle 8i Entreprise Edition product or should i use another oracle product to do this job ?
Thank youDownload our XSQL Pages technology with the XSQL Servlet and you'll be in business in no time. If you want to just get XML programmatically from SQL in your own programs, you can try the XML SQL Utility (which XSQL Pages makes use of under the covers). XSQL Pages comes with lots of demos and a tutorial.
-
How to compare result from sql query with data writen in html input tag?
how to compare result
from sql query with data
writen in html input tag?
I need to compare
user and password in html form
with all user and password in database
how to do this?
or put the resulr from sql query
in array
please help me?Hi dejani
first get the user name and password enter by the user
using
String sUsername=request.getParameter("name of the textfield");
String sPassword=request.getParameter("name of the textfield");
after executeQuery() statement
int exist=0;
while(rs.next())
String sUserId= rs.getString("username");
String sPass_wd= rs.getString("password");
if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
exist=1;
if(exist==1)
out.println("user exist");
else
out.println("not exist"); -
How to generate XML file from SQL file !
I am new to XML publisher. I known one way to generate XML file is register one report file in concurrent manager.
But I want to generate XML file from sql file.
Could someone show me how to code in sql file, how to register is in concurrent manager.
Thanks !Hi
Phew ... not sure we have the space here. So I can point you in the right direction:
1. XML data generation - there are two packages in the db you can use with a plsql procedure, XMLGEN and SQL XML. You can also use java APIs too. Try checking the db documentation and search for the above methods.
2. Registering the report - the system administrators guide will provide this info. Hooking the program up with XMLP is covered here - http://www.oracle.com/technology/products/applications/publishing/resource/CM%20Whitepaper5.0.pdf
Regards, Tim -
Odd results from SQL statement in JSP
Hi.
Getting very strange results from my SQL statement housed in my JSP.
the last part of it is like so:
"SELECT DISTINCT AID, ACTIVE, REQUESTOR_NAME, ..." +
"REQUESTOR_EMAIL" +
" FROM CHANGE_CONTROL_ADMIN a INNER JOIN CHANGE_CONTROL_USER b " +
"ON a.CHANGE_CTRL_ID = b.CHANGE_CTRL_ID " +
" WHERE UPPER(REQUESTOR_NAME) LIKE ? "; I've set the following variables and statements:
String reqName = request.getParameter("requestor_name");
PreparedStatement prepstmt = connection.prepareStatement(preparedQuery);
prepstmt.setString(1, "%" + reqName.trim().toUpperCase() + "%");
ResultSet rslts = prepstmt.executeQuery();
rslts.next();
int aidn = rslts.getInt(1);
int actbox = rslts.getInt(2); String reqname = rslts.getString(3).toUpperCase();
String reqemails = rslts.getString(4);
String bizct = rslts.getString(5);
String dept = rslts.getString(6);
String loc = rslts.getString(7);
Date datereq = rslts.getDate(8);
String busvp = rslts.getString(9);
AND SO ONSo then I loop it, or try to with the following:
<%
try {
while ((rslts).next()) { %>
<tr class="style17">
<td><%=reqname%></td><td><%=reqemails %></td><td><%=bizct %></td>td><%=dept %></td>
<td><%=aidn %></td>
</tr>
<%
rslts.close();
selstmt.close();
catch(Exception ex){
ex.printStackTrace();
log("Exception", ex);
%>AND so on, setting 13 getXXX methods of the 16 cols in the SQL statement.
Trouble is I'm getting wildly inconsistent results.
For example, typing 'H' (w/o quotes) will spit out 20 duplicate records of a guy named Herman, with the rest of his corresponding info correct, just repeated for some reason.
Typing in 'He' will bring back the record twice (2 rows of the complete result set being queried).
However, typing in 'Her' returns nothing. I could type in 'ell' (last 3 letters of his name, Winchell) and it will again return two duplicate records, but typing in 'hell' would return nothing.
Am I omitting something crucial from the while statement that's needed to accurately print out the results set without duplicating it and that will ensure returning it?
There's also records in the DB that I know are there but aren't being returned. Different names (i.e. Jennifer, Jesse, Jeremy) won't be returned by typing in partial name strings like Je.
Any insight would be largely appreciated.
One sidenote: I can go to SQL Plus and accurately return a results set through the above query. Having said that, is it possible the JDBC driver has some kind of issue?
Message was edited by:
bpropes20
Message was edited by:
bpropes20Am I omitting something crucial from the while
statement that's needed to accurately print out the
results set without duplicating it and that will
ensure returning it?Yes.
In this code, nothing ever changes the value of reqname or any of the other variables.
while ((rslts).next()) { %>
<tr class="style17">
<td><%=reqname%></td><td><%=reqemails %></td><td><%=bizct %></td>td><%=dept %></td>
<td><%=aidn %></td>
</tr>
<%
} You code needs to be like this:while (rslts.next()) {
reqname = rslts.getString(3).toUpperCase();
reqemails = rslts.getString(4);
bizct = rslts.getString(5);
dept = rslts.getString(6);
loc = rslts.getString(7);
datereq = rslts.getDate(8);
busvp = rslts.getString(9);
%>
<tr class="style17">
<td><%=reqname%></td><td><%=reqemails %></td><td><%=bizct %></td>td><%=dept %></td>
<td><%=aidn %></td>
</tr>
<%
There's also records in the DB that I know are there
but aren't being returned. Different names (i.e.
Jennifer, Jesse, Jeremy) won't be returned by typing
in partial name strings like Je.Well, you're half-right, your loop won't display all the rows in the result set, because you call rslts.next(); once immediately after executing the query. That advance the result set to the first row; when the loop is entered, it starts displaying at the 2nd row (or later if there are more next() calls in the code you omitted). -
How to make an XML file from SQL query on local disc (c:\temp)?
This query shows me XML results, but can I somehow make an XML file to local disc?
Thanks.
DECLARE @IMO NUMERIC(8,0)
DECLARE @Counter INT
SELECT @Counter = 1
WHILE ( @Counter <15 )
BEGIN
SET @IMO = (SELECT ImoNo from Vessel where ID=@Counter)
SELECT top 1
@IMO as ImoNumber,
VesselName,
Time,
lat as CurrentLatitude,
lon as CurrentLongitude,
sog as SpeedOverGround,
cog as CourseOverGround,
hdg as HeadingInDegrees,
GoingToCountry = (SELECT TOP 1 CountryName
FROM ShipSchedule
WHERE ImoNo = @IMO and DestPosArrived = 'false'
ORDER BY DestPosETA ),
GoingToHarbour = (SELECT TOP 1 Harbour
FROM ShipSchedule
WHERE ImoNo = @IMO and DestPosArrived = 'false'
ORDER BY DestPosETA ),
DestinationLatitude = (SELECT TOP 1 DestPosLAT
FROM ShipSchedule
WHERE ImoNo = @IMO and DestPosArrived = 'false'
ORDER BY DestPosETA ) ,
DestinationLongitude = (SELECT TOP 1 DestPosLON
FROM ShipSchedule
WHERE ImoNo = @IMO and DestPosArrived = 'false'
ORDER BY DestPosETA ),
ArrivalTime = (SELECT TOP 1 DestPosETA
FROM ShipSchedule
WHERE ImoNo = @IMO and DestPosArrived = 'false'
ORDER BY DestPosETA ),
GoingFromCountry = (SELECT TOP 1 CountryName
FROM ShipSchedule
WHERE ImoNo = @IMO and DestPosArrived = 'true'
ORDER BY DestPosETA desc),
GoingFromHarbour = (SELECT TOP 1 Harbour
FROM ShipSchedule
WHERE ImoNo = @IMO and DestPosArrived = 'true'
ORDER BY DestPosETA desc),
DepartureTime = (SELECT TOP 1 DestPosETD
FROM ShipSchedule
WHERE ImoNo = @IMO and DestPosArrived = 'true'
ORDER BY DestPosETA desc)
FROM Position
WHERE ImoNo = @IMO
order by time desc
for Xml AUTO,elements,root('SplosnaPlovba')
SELECT @Counter = @Counter + 1
ENDYou can use bcp with query out option
use your above query as the source query and use queryout option after specifying destination as your required local file path (specify extension as .xml)
see
http://visakhm.blogspot.com/2013/10/bcp-out-custom-format-data-to-flat-file.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
I have created XML File from Query using below function:-
select dbms_xmlgen.getxml('
select * from tblreports where rownum<=1') from dual;
"(CLOB) <?xml version="1.0"?>
<ROWSET>
<ROW>
<REPORTID>preRES0011</REPORTID>
<ALIAS>Date wise Summary of pins Report</ALIAS>
<ACTIVE>Y</ACTIVE>
<TITLE>Date wise Summary of pins Report</TITLE>
<QUERY>select tsb.month1,
count(SIDNUMBER)GENERATED,
sum(case WHEN SERIALSTATUSID='SRS01' THEN 1 ELSE 0 END)NotAllocated,
SUM(CASE WHEN SERIALSTATUSID='SRS02' or SERIALSTATUSID='SRS03' or SERIALSTATUSID='SRS05' THEN 1 ELSE 0 END)ALLOCATED,
SUM(CASE WHEN SERIALSTATUSID='SRS02' or SERIALSTATUSID='SRS01' THEN 1 ELSE 0 END)NOTASSIGNEDTORESELLER,
SUM(CASE WHEN SERIALSTATUSID='SRS03' THEN 1 ELSE 0 END)READYTOACTIVATE,
sum(CASE WHEN SERIALSTATUSID='SRS05' THEN 1 ELSE 0 END)ACTIVATED,
sum(CASE WHEN SERIALSTATUSID='SRS06' THEN 1 ELSE 0 END)Terminated,
sum(CASE WHEN SCRAPSTATUSID='CST01' THEN 1 ELSE 0 END)scraped,
sum(CASE WHEN LOCKSTATUSID='CST01' THEN 1 ELSE 0 END)locked,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
from (SELECT TO_CHAR(CREATEDATE,'DD-MON-YYYY')MONTH1 ,PINUSAGEMODEID,SERIALBATCHID,SERIALIDCOUNT,CREATEDATE FROM TBLMSERIALBATCH )TSB,
tblmserial ts
where TSB.SERIALBATCHID=ts.SERIALBATCHID
and to_char(TSB.CREATEDATE,'MON-YYYY')='$1'
GROUP BY TSB.MONTH1
order by TO_DATE(MONTH1,'dd-mon-yyyy') DESC</QUERY>
<CONNECTIVITYID>C0001</CONNECTIVITYID>
<INPUTREQUIRED>Y</INPUTREQUIRED>
<INPUTNAME>Month</INPUTNAME>
<CREATEDATE>30-JAN-10</CREATEDATE>
<LASTMODIFIEDDATE>22-FEB-10</LASTMODIFIEDDATE>
<CREATEDBY>reportadmin</CREATEDBY>
<LASTMODIFIEDBY>reportadmin</LASTMODIFIEDBY>
<TITLEPARAM>Y</TITLEPARAM>
<SUBTITLE>Date wise Summary of pins Report For &1</SUBTITLE>
<ELEMENTTYPEID>AET002</ELEMENTTYPEID>
<REPORTTYPEID>RTP01</REPORTTYPEID>
<SORTFIELD>Disable</SORTFIELD>
</ROW>
</ROWSET>
But in that it is taking ''' for ' ' instead of '$1' it is taking '$1'
how to keep ' ' in XML file instead of &apos?You can use bcp with query out option
use your above query as the source query and use queryout option after specifying destination as your required local file path (specify extension as .xml)
see
http://visakhm.blogspot.com/2013/10/bcp-out-custom-format-data-to-flat-file.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Problem in Flex to get XML result from web services
Hi all
I am struggling a proplem for a whole day, i hope somebody can help.
I am trying to get the list file of files located on the server, so i use flex to access a ASP.NET ASMX web services, that returns all the file names in a folder.
I can see that web servicese worked perfectly, however when i try to get the result from flex, i could not figure out how to get the real data i wantted
public function LoadImage(e:ResultEvent):void{
imageList.dataProvider = e.result;
the e.result has some addtional tags, such as
<GetImageFileListResponse xmlns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetImageFileListResult>
<images>
<image>01417_ccurve_1280x1024.jpg</image>
<image>1915619295407381096.png</image>
<image>21051802471898733113.png</image>
where GetImageFileList is the operation name used in web service
I am only interested in the data starting from <images> . I don't know why the addtioanl tag has been added.
here is the code i have used in flex.
<mx:WebService
wsdl="http://localhost/Flex/GetImageFiles.asmx?WSDL" id="imageWs">
<mx:operation name="GetImageFileList" result="LoadImage(event)" fault="mx.controls.Alert.show(event.fault.faultString)" resultFormat="
e4x">
</mx:operation>
</mx:WebService>
Thanks in advance!!!Hi,
Just replace the below line in your code and check...
imageList.dataProvider = e.result.GetImageFileListResult.images;
If this post answers your question or helps, please mark it as such.
Thanks,
Bhasker Chari -
Create XML file from SQL trigger
I have to create a XML file of a record when a certain column of table Absences is updated. I have the following bcp command in the (after update) trigger :
bcp "select absences.HID, absences.Amount,absences.Itemcode,absences.Itemcount, absences.[Description],absences.PRocessnumber, Cicmpy.ID from absences inner join cicmpy on cicmpy.cmp_wwn = absences.HID where absences.Type = 110 for
XML RAW (''Order''), ROOT (''Orders''), ELEMENTS XSINIL" QUERYOUT "c:\filename.xml" -T -SJR8512\sql2008 -c -d100'
When the trigger is fired, the table get's a lock, so the file isn't created. What am I missing?As Russ says: Service Broker is exactly what you want. The trigger would put a message on the Service Broker queue. (And the message would be the XML document created from the inserted/deleted tables.) In the other application you would have an activation
procedure that processes the message.
If you have never worked with Service Broker, this book is an excellent start:
http://www.amazon.com/Rational-Server-Service-Broker-Guides/dp/1932577270/ref=sr_1_1?ie=UTF8&qid=1399411944&sr=8-1&keywords=wolter+service+broker
Also, bookmark Remus Rusanu's blog:
http://rusanu.com/blog/
Lot's of tips there.
Erland Sommarskog, SQL Server MVP, [email protected] -
Different Results from SQL-Query in Oracle 10.2 and Oracle 11.2
Look at the following example:
CREATE TABLE GZP_PLAN (GZP_ID
NUMBER(9) NOT NULL, PARENT_GZP_ID NUMBER(9),
CONSTRAINT GZP_PLAN_PK1 PRIMARY KEY(GZP_ID)
USING INDEX
TABLESPACE USERS
TABLESPACE USERS;
insert into GZP_PLAN values(1,NULL);
CREATE TABLE GZP_WB (OBJECTID NUMBER
NOT NULL, GZP_ID NUMBER(10),
CONSTRAINT GZP_WB_PK1_1 PRIMARY KEY(OBJECTID)
USING INDEX
TABLESPACE USERS
TABLESPACE USERS;
insert into GZP_WB values(1,1);
CREATE OR REPLACE VIEW VW_GZP (GZP_ID1) AS
SELECT xxx.gzp_id
FROM gzp_plan xxx
WHERE gzp_id IN (
SELECT MAX (z.gzp_id) zzz
FROM gzp_plan z
START WITH z.gzp_id = xxx.gzp_id
CONNECT BY PRIOR gzp_id = parent_gzp_id);
-- query
select a.* from GZP_WB a where gzp_id in (select gzp_id1 from vw_gzp);
Result in Oracle 10.2. (Windows Server 2003 32-bit, Oracle 10.2.0.2 or Oracle 10.2.0.5, Enterprise Edition)
OBJECTID GZP_ID
*1 1*
Result in Oracle 11.2 (Windows Server 2008 64-bit, Oralcle 11.2.0.2, Enterprise Edition or Standard Edition One)
no rows selected
The result of the following queries are identical in Oracle 10.2 and 11.2
SQL> select * from GZP_WB where to_char(gzp_id) in
2 (select to_char(gzp_id1) from vw_gzp);
OBJECTID GZP_ID
1 1
SQL>
SQL> select a.* from GZP_WB a, vw_gzp b where a.gzp_id=b.gzp_id1;
OBJECTID GZP_ID
1 1The solution is Oracle 11.2.0.3 - patchset released 11th November.
-
Creating JTree with results from SQL Query
I have the following source in SQLJ:
String temp=null;
iter1 it1;
iter2 it2;
#sql it1={select id,fdn,level from groups connect by prior fdn=parent_fdn start with fdn='/' };
while(it1.next())
System.out.println(it1.id()); // Display Parent
temp=it1.fdn();
#sql it2= {select clli from nes where parent_fdn=:temp order by clli };
while(it2.next())
System.out.println(it2.clli());//Display Child of above Parent if any
My problem is to construct a Tree GUI using JTree from the above
code with the same hierarchy of parent-child relationship.
I have tried every possible solution using Vectors,Hashtables,String Arrays etc but have not come up with a successful solution so far
IF ANYONE HAS A SOLUTION PLEASE HELP ME WITH AN EXAMPLE.
Thank You
Sharathsharathkv,
Your issue seems to be in figuring out an algorithm to convert row-based SQL resultsets to a hierarchical data structure suitable for display in a tree.
Run the jython (www.jython.org) app below: it simulates doing just that. jython is indentation-sensitive, so you'll need to exercise care when copying. If copy-paste to a text editor doesn't work, copy-paste to a HTML-aware editor (even Outlook Express, if on Windows), then copy from there and paste in a text editor.
--A
This is a jython (www.jython.org) app that illustrates
converting row-based data (eg. a SQL resultset) to a custom
hierarchical data structure, and displaying it in a JTree.
from javax.swing import *
from javax.swing.tree import *
import java
def getSQLRows():
Simulates a SQL resultset.
Columns fdn and parent-fdn indicate parent/child relationships.
rows = [
# id, fdn, parent-fdn, level
[1, '/', None, 1]
, [2, '/fruits', '/', 2]
, [3, '/colors', '/', 2]
, [4, '/sports', '/', 2]
, [5, '/fruits/apples', '/fruits', 3]
, [6, '/fruits/oranges', '/fruits', 3]
, [7, '/colors/red', '/colors', 3]
, [8, '/colors/blue', '/colors', 3]
, [9, '/sports/petanc', '/sports', 3]
, [10, '/sports/rugby', '/sports', 3]
return rows
def convertRowsToHierarchy(rows):
Converts row-based results to hierarchical structure.
Uses known parent/child relations present in rows.
root = None
for row in rows:
fdn, parentfdn = row[1], row[2]
node = SQLTreeNode(fdn, parentfdn)
if root:
root.addEx(node)
else:
root = node
return root
class SQLTreeNode(java.lang.Object):
'''Custom tree node; displayed in JTree'''
def __init__(self, fdn, parentfdn):
self.fdn = fdn
self.parentfdn = parentfdn
self.nodes = []
def add(self, node):
'''Adds node as immediate child'''
self.nodes.append(node)
def addEx(self, node):
'''Adds-with-search. NOTE: naive implementation'''
if self.fdn == node.parentfdn:
self.add(node)
else:
for child in self.nodes:
child.addEx(node)
def toString(self):
return self.fdn
def dump(self):
'''Debug routine to dump hierarchy'''
print 'fdn=%s, parentfdn=%s' % (self.fdn, self.parentfdn)
for node in self.nodes:
node.dump()
class SQLTreeModelAdapter(TreeModel):
'''Tree model adapter: adapts custom data structure to TreeModel'''
def __init__(self, root):
self.__root = root
def getChild(self, parent, index):
return parent.nodes[index]
def getChildCount(self, parent) :
return len(parent.nodes)
def getIndexOfChild(self, parent, child):
return parent.nodes.index(child)
def getRoot(self) :
return self.__root
def isLeaf(self, node):
return len(node.nodes) == 0
def addTreeModelListener(self, l):
pass
def removeTreeModelListener(self, l):
pass
def valueForPathChanged(self, path, newValue):
pass
class SQLTreeDemo(JFrame):
Tree demo UI
Displays a tree displaying [hierarchical] results
of a BOM-type SQL query
def __init__(self):
# Get matrix simulating SQL resultset
rows = getSQLRows()
# Convert to custom hierarchical data structure
root = convertRowsToHierarchy(rows)
model = SQLTreeModelAdapter(root)
tree = JTree(model)
sp = JScrollPane(tree)
self.contentPane.add(sp)
self.size = 200, 300
if __name__ == '__main__':
s = SQLTreeDemo()
s.visible = 1 -
Get Comma separated result from SQL Query
Hey Everyone
I have a requirement where i need to get comma separated result of names because there is one to many relationship i.e for every protocol there are mutiple people associated to it , and i created PL/SQL function for that and everything was fine and when it is in production multiple number of cursors were opened because of the logic and leading to RAC fail over and for that we were manually clearing the cursors every weekend and i am looking to create a Materialized view for this logic but i was unable to code the logic using Connect by clause
Result is like and i want comma separated names for every protocol
P06065 TESTER13 TESTER13
P02095 PATRICIA CARMELITANO
P02095 ANNE MUIR
P02095 ROBERT HARLOW
P02095 JANICE ALBERT
P02095 Jacqueline van Dalen
P02095 GUENTER HENNIG DR.
P05209 Olga Xenaki
P05553 Birgit Limbach-Angele
P05553 Anja Schulz Dr.
P05553 CHRISTA HAGENBUCHER
here is the function which i wrote, i need to get the same logic through SQL Statement .. thanks for your help
cursor c_GSCR is
select T565804.FST_NAME||' '||T565804.LAST_NAME
from
S_PT_POS_HST_LS T544105 /* S_PT_POS_HST_LS_Protocol_Team */ ,
S_CONTACT T565804 /* S_CONTACT_Protocol_Team */,
S_CL_PTCL_LS T541903 /* S_CL_PTCL_LS_Protocol */
where ( T541903.ROW_ID = T544105.CL_PTCL_ID and
T544105.POSTN_ID = T565804.PR_HELD_POSTN_ID and
T544105.ROLE_CD = 'Lead Project Manager' AND
T541903.ROW_ID = v_PTCL_ID and
T541903.PAR_PTCL_ID is null and T544105.END_DT is null );
BEGIN
l_row_num := 0;
l_role := '';
l_role_list := '';
v_PTCL_ID := PTCL_ID;
OPEN C_GSCR;
if C_GSCR%isopen THEN
LOOP
FETCH C_GSCR INTO l_role;
exit when C_GSCR%notfound;
IF l_role_list IS NULL THEN
l_role_list:=l_role;
ELSE
l_role_list:=l_role_list||', '||l_role;
END IF;
END LOOP;
CLOSE C_GSCR;
end if;
~SrixHi,
Srix wrote:
Thanks for the Info .. My database in 10g R 2 i started using COLLECT Function
select T541903.PTCL_NUM ,
CAST(COLLECT(T565804.FST_NAME||' '||T565804.LAST_NAME) AS varchar2_ntt) , 7) AS LPM_NAME
from
S_PT_POS_HST_LS T544105 /* S_PT_POS_HST_LS_Protocol_Team */ ,
S_CONTACT T565804 /* S_CONTACT_Protocol_Team */,
S_CL_PTCL_LS T541903 /* S_CL_PTCL_LS_Protocol */
where T541903.ROW_ID = T544105.CL_PTCL_ID and
T544105.POSTN_ID = T565804.PR_HELD_POSTN_ID and
T544105.ROLE_CD = 'Lead Project Manager' AND
T541903.PAR_PTCL_ID is null and T544105.END_DT is null
GROUP BY T541903.PTCL_NUM
The result i like ...Do you mean "The result *is* like ..."?
Or do you mean "The result I [would] like [is] ..."?
The code above has unblanaced parentheses. If you are getting anything other than an error message, then I don't believe you are really running what you posted.
Whenever you have a problem, post a complete test script that people can use to recreate the problem and test their ideas.
Please do that. Post CREATE TABLE and INSERT statements to crate the sample data, the code you used to create the carachr2_ntt type and the function, and your best attempt at a query (formatted). Simplify as much as possible. For example, do you really need 3 tables to illustrate the problem? For purposes of asking a question on this forum, can't you pretend you have just one table, with 2 columns?
I suspect the problem has to do with the user-defined type and function, which you didn't post. I can't even see how you called the function in your query. Without the information I mentioned above, there's not much I can do to help you. -
How to get accurate results from sql code ?
Hello everybody,
I have a problem with some portion of my code.
I get more results than I specify in the where clause.
Here is the sample code:
c.gl_acct_id between '110'||'-'||'6890'||'-'||'69000'||'-'||'%'
and '110'||'-'||'7000'||'-'||'67999'||'-'||'%'
For some reason I also get the following results back:
110-6910-51001-001, and 110-6910-51003-001 But I don't need the 51001 and 51003. How do I specify in sql what range I really want. I was sure that the code above is correct. I guess not.
I would appreciate any help,
Thanks,
SonyaHave you tried using the query either of the following...
1) c.gl_acct_id between '110-6890-69000-000'
and '110-7000-67999-999'
and c.gl_acct_id not like '110-6910-51001-%'
and c.gl_acct_id not like '110-6910-51003-%'
assuming you have only 3 digits at the end of gl_acct.
2)If you know that your acct_id belongs to only 69000 or 67999
then
(c.gl_acct_id LIKE '110-6890-69000-%' OR
c.gl_acct_id LIKE '110-7000-67999-%' )
Plz. let me know if this not what you are looking for.
thanx
rajkiran
Here is the whole script:
select distinct c.gl_acct_id acct_no,
c.gl_acct_desc,
min(a.local_act_beg_bal) local_act_beg_bal,
sum(b.local_act_mtd_dr_amt) debits,
sum(b.local_act_mtd_cr_amt) credits,
nvl(min(a.local_act_beg_bal),0)+sum(nvl(b.local_act_mtd_dr_amt,0))-
sum(nvl(b.local_act_mtd_cr_amt,0)) end_bal
from gl_acct c, gl_acct_bal a, gl_acct_bal b
where c.org_unit_id = '110'
and b.gl_acct_id = c.gl_acct_id
and a.gl_acct_id = c.gl_acct_id
and c.sum_det_ind = 'D'
and c.gl_acct_class_ind in ( 'A' , 'L' , 'Q' , 'I' , 'E' )
and a.year_no = '2001'--:loyear
and a.period_no = '1'--:loperiod
and ( ( b.year_no = '2001'--:hiyear
and b.period_no between '1'--:loperiod
and'13')-- :hiperiod
and c.gl_acct_id between '110'||'-'||'6890'||'-'||'69000'||'-'||'%'
and '110'||'-'||'7000'||'-'||'67999'||'-'||'%'
group by c.gl_acct_id, c.gl_acct_desc
I want to have ability to specify ranges for gl_accoount.
Thanks,
Sonya -
Getdocument function (Loading an xml document from sql plus)
Hello,
I quote from the XML Database Developer's Guide. It appears to be possible to specify an xml file in the query using the following syntax:
INSERT INTO XMLTABLE
VALUES(XMLTYPE(getDocument(purchaseorder.xml)));
Where purchaseorder.xml is a document.
However I get the following error message when I use this getdocument function:
ora-00904 "getdocument" invalid identifier.
Can anyone help?
Balteo.Hi,
This is the function that has been specified in the developer's guide.
create or replace function getDocument(filename varchar2) return clob
authid current_user is
xbfile bfile;
xclob clob;
begin
xbfile := bfilename(XMLDIR,filename);
dbms_lob.open(xbfile);
dbms_lob.createtemporary(xclob,TRUE,dbms_lob.session);
dbms_lob.loadfromfile(xclob,xbfile, dbms_lob.getlength(xbfile));
dbms_lob.close(xbfile);
return xclob;
end;
Hope this helps,
Rajat -
Inconsistent results from sql DB 11.2.0.2
can anyone see why the statement below would return no data?
SELECT CUSTOMER_NAME,
CUSTOMER_NUMBER,
CUSTOMER_ID
FROM APPS.RA_CUSTOMERS
WHERE (UPPER(CUSTOMER_NAME) LIKE 'B%'
AND (CUSTOMER_NAME LIKE 'b%'
OR CUSTOMER_NAME LIKE 'B%'))
ORDER BY CUSTOMER_NAME
when this one does
SELECT CUSTOMER_NAME,
CUSTOMER_NUMBER,
CUSTOMER_ID
FROM APPS.RA_CUSTOMERS
WHERE (CUSTOMER_NAME LIKE 'b%'
OR CUSTOMER_NAME LIKE 'B%')
ORDER BY CUSTOMER_NAME
ThanksBoth the queries seem to be the same,
Both of them should return same data. Please double check(any un committed data etc). Post the table data here.
why dont you just use this?
SELECT CUSTOMER_NAME, CUSTOMER_NUMBER, CUSTOMER_ID
FROM APPS.RA_CUSTOMERS
WHERE UPPER (CUSTOMER_NAME) LIKE 'B%'
ORDER BY CUSTOMER_NAMEG.
Maybe you are looking for
-
Setting dynamic values to entity object
Is there any way to set bean values (dynamic values) to Entity Object while commit the record, and how can i set these values using Groovy language Thanks in advance
-
How come my iPod dosnt turn on anymore?
ok heres the problem... today I wake up all happy and stuff but when I go to pick up my iPod to listen to music it wont turn on. it just shows the sad iPod icon and a link to support. I already tried the 5 steps and trying to startup in diskmode. it
-
Is BPC 7.0 compatible with Windows Terminal Server 2008?
Is BPC 7.0 compatible with Windows Terminal Server 2008? We are having printing issues when on WTS 2003.
-
Hi Experts, I have difference modules implemented for my client like ECC,HSCM,SRM,PI ect..... with huge landcale and clients want to gr for CUA. My query is can we use Solution Manager as a CUA for managing all the security related task centrall for
-
Elements keeps freezing when using healing brush - can you help? Running Yosemite
Elements keeps freezing when I try to use healing brush tool. I'm running Yosemite. Tried to download a "plug-in" workaround, but it just comes up blank. Can you please help?