Need a query to retrive reocrds from a blob data type!
Hi,
I need a sql query to check in a cloumn which is a blob data type ,where the column stores the XML values and the query should check a particular value in the column if value is there it shud return with yes or no.
Thanks for your reply...
Let me clearly explain my need.. for instance a table xyz and in that we have 5 columns but based on some conditions on 3 columns i need to retrive the records..like..
select * from xyz where a=** and b=** and c=***; here i need to pass the values of a,b and c while runtime only and not as static values and also i need to return with a message like records found,not found based on the condition where the particular record for the column C is there or not there.
Similar Messages
-
Caml query to retrive keyword from rich text field
hi friends
i am using below caml query to retrieve data from title field and Rich text field(Definition)
<View>
<Query>
<Where>
<And>
<Or>
<Eq>
<FieldRef Name=\'Title\'/>
<Value Type=\'Text\'>'+letter+'</Value>
</Eq>
<Contains>
<FieldRef Name=\'Definition\' />
<Value Type=\'Note\'>'+letter+'</Value>
</Contains>
</Or>
<Neq>
<FieldRef Name=\'status\' />
<Value Type=\'Text\'>Not approved</Value>
</Neq>
</And>
</Where>
<OrderBy><FieldRef Name=\'Title\' /></OrderBy>
</Query>
</View>
this query is working fine. But it is retrieving some extra fields also which doesn't have the queried string. and even it is retrieving keyword from image urls which are present in rich text field.
Please help me to retrieve key word from plain text of rich text field.Hi,
According to your post, my understanding is that you want to use caml query to retrive keyword from rich text field
By design, when specifying a ViewFields clause, values for these fields are returned, together with a few system columns like ID, Created and Modified.
If you query rich text field, it will return the field with HTML tags.
To retrieve key word from plain text of rich text field, you need to use regular expression to remove the HTML tags.
You can use the code below:
using (SPSite site = new SPSite("http://sitename"))
using (SPWeb spWeb = site.OpenWeb())
SPList spList = spWeb.Lists.TryGetList("ListName");
SPQuery qry = new SPQuery();
if (spList != null)
qry.Query =
@" <Where>
<Contains>
<FieldRef Name='Rich_x0020_Text' />
<Value Type='Note'>caml</Value>
</Contains>
</Where>";
qry.ViewFields = @"<FieldRef Name='Title' /><FieldRef Name='Rich_x0020_Text' />";
SPListItemCollection listItems = spList.GetItems(qry);
foreach (SPListItem item in listItems)
string src = item["Rich_x0020_Text"].ToString();
Regex htmlReg = new Regex(@"<[^>]+>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
src = htmlReg.Replace(src, string.Empty);
Console.WriteLine(src);
Console.ReadKey();
The result is as below:
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Need help :: how to search in nested table/varray data type
I have the following structure...
CREATE TYPE lang_con AS VARRAY(15) OF VARCHAR2(50);
CREATE TYPE rel_con AS VARRAY(15) OF VARCHAR2(50);
CREATE TABLE Country_n(
"NAME" VARCHAR2(40 BYTE) CONSTRAINT "COUNTRY_NAME_NOTNULL_N" NOT NULL ENABLE,
"CODE" CHAR(2 BYTE),
"CAPITAL" VARCHAR2(40 BYTE),
"PROVINCE" VARCHAR2(40 BYTE),
"POPULATION" NUMBER,
"AREA" NUMBER,
"LANGUAGES" lang_con,
"RELIGIONS" rel_con
after inserting data from 3 different table (country, language, religion) the table looks like this....
Cyprus cy Nicosia Government controlled area 775927 9250 VARCHAR(English,Greek,Turkish) VARCHAR(Greek Orthodox,Muslim)
Czech Republic cz Prague Prague 10246178 78866 VARCHAR(Czech) VARCHAR(Orthodox,Protestant,Roman Catholic)
Germany de Berlin Berlin 82424609 357021 VARCHAR(German) VARCHAR(Muslim,Protestant,Roman Catholic)
Djibouti dj Jibuti Jibuti 466900 23000 VARCHAR(Afar,Arabic,French,Somali) VARCHAR(Christian,Muslim)
Denmark dk Copenhagen Frederiksberg Kommune 5413392 43094 VARCHAR(Danish,Faroese,German,Greenlandic) VARCHAR(Evangelical Lutheran,Muslim)
now I want to get the countries in which german language is being spoken. Actually I need to know how to search in this custom data type of mine....I also need to perform other operation further so really need to know how can I search in this custom data type...
when I execute the following query....
select * from country_n cn where cn.languages like '%German%' order by name
I got the following error....
Error starting at line 1 in command:
select * from country_n cn where cn.languages like '%German%' order by name
Error at Command Line:1 Column:33
Error report:
SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got AHMADM.LANG_CON
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:
let me know please...looking forward to your replies....
Thanks,Hi,
Try this:
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> SELECT t1.*
2 FROM country_n t1,
3 TABLE(t1.languages) t2
4 WHERE column_value LIKE '%German%';
NAME CODE CAPITAL PROVINCE POPULATION AREA LANGUAGES RELIGIONS
Germany de Berlin Berlin 82424609 357021 <Object> <Object>
SQL> Regards, -
Datas return from Blob data type in Sqlite
i am using sqlitejdbc-v053.jar through get SQLITE BLOB data type data. But i cannot data return from Blob type.
Error will be display from :
not implemented by SQLite JDBC driver
and point out error line
blob = rs.getBlob("NGP_REPDATA");
{try {
Class.forName("org.sqlite.JDBC");
conn = DriverManager.getConnection("jdbc:sqlite:test.DB");
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT * FROM sometable");
System.out.println("==============");
while(rs.next()) {
blob = rs.getBlob("blobDATA");//
is = blob.getBinaryStream();
catch(SQLException e) {
e.printStackTrace();
}}any sample or solution pls give
sqlite with BLOB sample there pls give linkThere explicitly tells you that the JDBC driver that you are using will not do the method that you are calling.
Thus you cannot use that method.
There is another way to extract blobs which involves using a stream. You can search for that.
If your blobs are actually short and only have character data then you might be able to use getString() as well. -
How to store and retrieve blob data type in/from oracle database using JSP
how to store and retrieve blob data type in/from oracle database using JSP and not using servlet
thanksJSP? Why?
start here: [http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html] -
Need a Query for getting ItemCost from PO Vendor wise
Hi,Experts We are not maintain different price list for some particular items , We raised the PO for Multiple vendors with differnt price for the same material. We need a query to find the Item cost with Various Vendor .
I need the query in the following format
Po Number, Vendor Name,Item Name, Item Description,Qty, Price,Tax.
Thanks
KamalHi,
Check this query which looks for the Item doctype Purchase Order and brings the data accordingly :
select t0.docnum as 'PO Number', t0.CardName as 'Vendor name', t1.itemcode as 'Item Name',
t1.Dscription as 'Item Description', t1.quantity as 'QTY', t1.Price as 'Price',
t1.vatsum as 'Tax Amount'
from OPOR t0 inner join POR1 t1 on t0.docentry = t1.docentry
where t0.doctype ='I'
Group by t1.itemcode, t1.Dscription, t0.docnum,
t0.cardname, t1.quantity, t1.Price, t1.vatsum
Order by t1.Itemcode
Check if it helps.
Kind Regards,
Jitin
SAP Business One Forum Team -
Need a query to compile .sql from sql+
Hi All,
I need to run a .sql file from sql+plus .
So share me the query to do this.1011786 wrote:
Hi All,
I need to run a .sql file from sql+plus .
So share me the query to do this.
Hi
SQL> select dummy,sysdate from dual;
D SYSDATE
X 11-JUN-2013
SQL> save test_dual.sql
Created file test_dual.sql
SQL> @test_dual.sql
D SYSDATE
X 11-JUN-2013
SQL>
Hope this helps
Regards,
Achyut Kotekal -
How to display images in BI Publisher from a LONG data type
We are storing images in Oracle Database as LONG data type. When I am giving query in BI Publisher and view the XML generated, I am getting the following error.
name was started with an invalid character. Error processing resource 'http://.......
<X_SIGNATURE>"N!0$$$$$$$#B!0$$$"X$$$$!3$$$!2$$#a$$$!1$!1$$$$$d$$$$#7$"X!0$"}@E$e"1"XM">K#@!P!P!Ga}!1!@!P!C#C"O!>...
Can anyone suggest the solution?Hi
my problem is, for each job_id there is many users. Oh that's something completlty different...
I Strongly Recommand to_
1.*create 2 tables Jobs & users*
2.*create a relation between them* 1 to many to get for each job more than a user that's the way that Must be -- execuse me the bad design of the db pulled u into this trap -
3.then u can deal with it normally no need to a sample code but just a form with Jobs as (Master) and Users as (detail) with a relation and with a simple query u can display each job_id is for many users.
no null values no commas r needed.
Hope this helps...
Regards,
Amatu Allah. -
Problem with a query with a BLOB data type
Hi i've a problem with this query in 11g. R1
SELECT
LOGTIMESTAMP,
LOGTIMEMILLIS,
MSGID,
XMLTYPE(MESSAGEBODY, nls_charset_id('AL32UTF8')).getClobVal() as LLamada
FROM
vordel.AUDIT_MESSAGE_PAYLOAD,
vordel.AUDIT_LOG_POINTS
WHERE
AUDIT_LOG_POINTS.LOGPOINTSPK = AUDIT_MESSAGE_PAYLOAD.MP_LOGPOINTSPK AND
LOGTIMESTAMP between TO_TIMESTAMP('03-12-2011 00:00','DD-MM-YYYY HH24:MI') and TO_TIMESTAMP('03-12-2011 12:00','DD-MM-YYYY HH24:MI')
and filtertype = 'LogMessagePayloadFilter'
and filtername like 'Log Llamada%'MESSAGEBODY: data type of the Column is BLOB
throw this error after execute the query
Error:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00200: could not convert from encoding UTF-8 to UCS2
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 283
ORA-06512: at line 1Could you check the BLOB really contains UTF-8 encoded XML?
What's your database character set?The BLOB contains UTF-8 Encoded
and the database where i am connectes have AL32UTF8 character set, but my internal instance have "AMERICAN_AMERICA.WE8ISO8859P1"
that is a problem?
How could I change the character set of the oracle local client to the character set of the remote oracle data base? -
Accessing data from an abstract data type
I've been trying to find a way to split up a comma in delimited string PL/SQL, and the following article has helped me do that:
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:8861471892664
Basically, the solution calls for creating a simple data type which looks like this:
create or replace type myTableType as table of
numberThis will hold the parsed data, which is populated by calling the str2tbl function. But the article doesn't explain how to access the data inside this table once it's been populated.
For example, I create the type myTableType and the function str2tbl, and run this query:
SQL> select str2tbl('4,2,3,4') from dual;
STR2TBL('4,2,3,4')
MYTABLETYPE(4, 2, 3, 4)The function returns a table of type myTableType, but I have no idea how access or index the data. I want to be able to access the 4, the 2, the 3, or the 4 of the result that is returned in the above example. Here's what I've tried:
SQL> select temp(1) from (select str2tbl('4,2,3,4') as temp from dual);
select temp(1) from (select str2tbl('4,2,3,4') as temp from dual)
ERROR at line 1:
ORA-00904: "TEMP": invalid identifierI get the invalid identifier error on pretty much any attempt to get to the data. This seems to be something that's easy to do but I just can't figure it out. Any help would be appreciated, thanks!Have a look at this thread and scroll all the way to the bottom
http://asktom.oracle.com/pls/ask/f?p=4950:8:11331947847331890504::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:110612348061,
Regards,
Steve Rooney -
Need a Query to update table from another table.
I have two tables Table A and Table B , till now in table “A”. I have a column which consist of IDs and duplicate IDs( which are basically formed by Original Ids) , I have another table i.e. table “B” , which gives a mapping between original ids and duplicate Ids
TABLE A:
ID/DUPLICATEID NAME
1 Rahul
1_CAD Pawan
2 Nikhil
3 TOM
3_CAD Ravi
3_MQ Puneet
TABLE B:
ORIGINALID DUPLICATEID
1 1_CAD
3 3_CAD
3 3_MQ
Now I want to have another column in Table “A” , which will give me the mapping between the original Id and duplicate Id as shown in updated table “A”.
UPDATED TABLE A:
ID/DUPLICATEID NAME ORIGINAL_ID
1 Rahul
1_CAD Pawan
2 Nikhil
3 TOM
3_CAD Ravi
3_MQ Puneet
Now I want to write a Query in which I can update this column (ORIGINAL_ID) of Table “A”, from the table B(basically want to update mulitple rows using single query), because table B already has this mapping. Can any one help me in this. I am basically a Java guy , so I don’t know much about it. I hope to get a positive response from you people, Thanks in advance!Here you go...
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%">
<code>
SQL> CREATE TABLE A (ID VARCHAR2(10), NAME VARCHAR2(10), NEW_ID VARCHAR2(10));
Table created.
SQL> INSERT INTO A VALUES ('1', 'Rahul', '');
1 row created.
SQL> INSERT INTO A VALUES ('1_CAD', 'Pawan', '');
1 row created.
SQL> INSERT INTO A VALUES ('2', 'Nikhil', '');
1 row created.
SQL> INSERT INTO A VALUES ('3', 'TOM', '');
1 row created.
SQL> INSERT INTO A VALUES ('3_CAD', 'Ravi', '');
1 row created.
SQL> INSERT INTO A VALUES ('3_MQ', 'Puneet', '');
1 row created.
SQL> CREATE TABLE B (ID VARCHAR2(10), NAME VARCHAR2(10));
Table created.
SQL> INSERT INTO B VALUES ('1', '1_CAD');
1 row created.
SQL> INSERT INTO B VALUES ('3', '3_CAD');
1 row created.
SQL> INSERT INTO B VALUES ('3', '3_MQ');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> UPDATE A
2 SET NEW_ID = NVL((SELECT B.ID FROM B WHERE A.ID = B.NAME),A.ID)
3 /
6 rows updated.
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM A;
ID NAME NEW_ID
1 Rahul 1
1_CAD Pawan 1
2 Nikhil 2
3 TOM 3
3_CAD Ravi 3
3_MQ Puneet 3
6 rows selected.
</code></pre>
Note: While asking question do give us DML/DDL script. It will make peoples life better.
Karthick.
http://www.karthickarp.blogspot.com/ -
Return data from all columns apart from a certain data type.
Bit stuck on something, hope somebody here can help:
I want to do a 'select * from ' a table, to return all columns except ones of a certain datatype. ie. I want to return data from all columns, excluding columns of datatype 'SDO_GEOMETRY'.
This gives me the list of columns:
SELECT COLUMN_NAME
FROM USER_TAB_COLUMNS
WHERE TABLE_NAME = 'ORDER_ITEM'
AND DATA_TYPE <> 'SDO_GEOMETRY'; But I can't seem to take it any further...
Now if I knew the columns beforehand, then of course I could just list them, excluding the geometry column, but this is to be used for a plug-in for MS Word, where a user can pick database columns to dynamically fill a report from - but I don't want the geometry columns as these can't be handled in this way.Hi Reggie,
> connects to the database and presents a list of tables
My guess is that this macro is written so it selects from all_tab_cols.
Change that plugin and let it select from a view like the one above. That way, the users won't be able to see/pick anything that you are not able/willing to present for them.
Edit:
You could even tease your users, and let them see the columns, but not being able to pick them.
create or replace view available_tab_columns
as
select decode(pickable.data_type, null, 0, 1) pickable
,atc.* -- narrow down yourself
from all_tab_cols atc -- or maybe user_tab_cols
,(select 'CHAR' data_type from dual union all
select 'DATE' from dual union all
select 'NUMBER' from dual
-- complete positive list, yourself
) pickable
where atc.data_type = pickable.data_type(+);Regards
Peter
Message was edited by:
Peter Gjelstrup -
Help needed in extracting pipe delimited fields in a CLOB data type
hi
i Had a table with clob field as shown below.
CREATE TABLE TRANSACTION_INFO
TRASACTION_ID CLOB,
LOG_ID NUMBER
Insert into TRANSACTION_INFO
(TRASACTION_ID, LOG_ID)
Values
('354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123);
Insert into TRANSACTION_INFO
(TRASACTION_ID, LOG_ID)
Values
('354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456);
COMMIT;As you can see Clob field is a pipe delimited data.Now i am able to extract the first two fields using the below querry.But it may be the right solution as
substring function fails if there is missing character in any on the fields.
Also when there is a null value in any of the fields,how can i be able to get as null value ? Basically i want to get the values in a delimited manner.
how can we do this ?
Select Substr (TRASACTION_ID, 1, Instr (TRASACTION_ID, '|')-1) field1,
Substr (TRASACTION_ID, 17, Instr (TRASACTION_ID, '|')+2) field2
From TRANSACTION_INFO;
output should be like as shown
FIELD1 FIELD2 FEILD3 FEILD4
354502002020910 000000610214609663 09/27/09 08:02:37
354599892020910 000000610214609663 09/27/10 08:12:47Thanks
Redehi Michael
Thanks for the solution and its my bad not mention that there is a possibility of having a null value at the start of the record also which RPLACE function no longer works for this case.
For example
with transaction_info (trasaction_id, log_id)
as (
select '354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123 from dual union all
select '354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual union all
select '|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual
select trim(regexp_substr (trasaction_id, '[^|]+', 1, 1)) f1,
trim(regexp_substr (trasaction_id, '[^|]+', 1, 2)) f2,
trim(regexp_substr (trasaction_id, '[^|]+', 1, 3)) f3,
trim(regexp_substr (trasaction_id, '[^|]+', 1, 4)) f4,
trim(regexp_substr (trasaction_id, '[^|]+', 1, 5)) f5
from (select replace (trasaction_id, '||', '| |') trasaction_id from transaction_info)
F1 F2 F3 F4 F5
354502002020910 000000610214609663 09/27/09 08:02:37 RNEW
354599892020910 000000610214609663 09/27/10 08:12:47 SOLD
000000610214609663 09/27/10 08:12:47 SOLD Now the last record is wrongly created.... -
What needs to be done in OBIEE 11g when underlying data types change?
I have an SQL table that I am referencing. It contains several date fields that were varchar(8). In order to do calculations, I just cast the fields as date, and performed my calculation.
Recently, the DBA changed the fields to date type.
I did a "View Data" and "Update row count", but it seems as if OBIEE is still treating the fields as varchar fields.
What is the proper procedure in OBIEE 11g to recognize the changes that occurred in the underlying table?Hi
In your scenario, I can suggest you can change manually to each field lengths in physical layer.
If you really looking one time fix then try to import the new table stricture into new rpd then save it then try to merge original rpd . – But it is risky process ( We have two methods, patch merge and fully repository merge).
Before doing above method take the backup original rpd and do it in your local.
Thanks,
Satya Ranki Reddy -
Getting a Time value from a datetime data type in SQL Server - URGENT!
Hi guys
I have an urgent issue here -
I have a datetime data type in a SQL Server database. The field holds both a time, and a date within it.
I am able to pull the date out of the field by using:
Date sDate = Date();
while (gd.next()) {
sDate = gd.getDate(2);
how do this with the time????
ThanksHi,
The funny part here is that you have already done it! The API is a great thing to use to help in your programming.
API: The class Date represents a specific instant in time, with millisecond precision.
You want time, you got it! How about:
sDate.getTime();
sDate.getMinutes();
sDate.getHours();
sDate.getSeconds();
Not enough?
Maybe you are looking for
-
No AVCHD or any HD supported in CS 5.5 ?!
Hello everybody, Today i installed the Adobe CD 5.5 master package, and when i started Premiere Pro i immediately noticed that there where no video presets supporting any kind of modern HD video such as AVCHD or XDCAM. So i made my own preset and tri
-
BPM distroy the SWCV design pattern
Hi XIer, I am designing our SWCV as following: We need to integration one SAP R3 and 3 legacy systems using XI. So we created one SWCV for creating Data type, interface type and interface message for SAP,another 3 SWCV for 3 legacy systems for interf
-
So if I do a search and find the answer to my question is there any way for me to give the poster some points?
-
How To Install Older Version of OSX on Second Account
I still use my Elements 8 Photoshop with a plug-in supplemental application called Essentials which is now not supported on the latest OSX mavericks business, and I'm sure Elements 8 isn't to far behind either. So is there any way I can put back one
-
itunes freezes up with no error message. Previous to this, I downloaded ios6 for iphone and that failed as well. The iphone is frozen too. Any ideas?