I would like to convert a blob of an oracle db to an readable string.
I have tried some functions, but none of them worked for me.
In the end I tried to convert the string via sql statement like:
SELECT CONVERT(CAST(blob as BINARY) USING utf8) as blob FROM tablewithblob
Can anyone tell me, what I am doing wrong? The error of the sqldeveloper is "missing right paranthesis. Thanks in advance!
The CONVERT(value USING charset) function is a mysql function, not Oracle
https://www.w3schools.com/sql/func_mysql_convert.asp
Take a look at this instead
https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions027.htm
But it looks like DBMS_LOB is a better way to do what you're doing in Oracle. Go check out How do I get textual contents from BLOB in Oracle SQL
Related
I've been trying to find a way to decode a base64 column in a bigquery table to a GUID/UUID. Does anyone know of a function in SQL that I can do this with or would I have to use a different language than SQL.
If understand correctly, SELECT FROM_BASE64(guid_column) AS id should do it for you.
I am trying to convert an Oracle query to a SQL Server and facing an issue. Can you please help me ?
Oracle Query:
select ORA_HASH(SYS_GUID()) as SEGMENTID from my_Table
I am looking for a function which is equivalent to ORA_HASH() function in SQL Server. I was searching in google and found that HASHBYTES() function is the one which works as ORA_HASH in SQL Server. But when I tried to use, the return value of this is Hexa decimal and on the other hand, ORA_HASH is returning an integer.
Can you please help me in proving the equivalent function to ORA_HASH in SQL Server which works same as ORA_HASH ?
You shall try CHECKSUM which as per doc is intended for use in building hash indexes. https://learn.microsoft.com/en-us/sql/t-sql/functions/checksum-transact-sql
Does anyone know if it is possible to get the length of the contents of a varbinary field using SQL with Advantage Database Server V11?
Regards
The obvious function to look for would be LENGTH(field) or LEN(field) (see online help).
If those only work on character fields, then you can always cast.
I'm trying to read BLOB data in the form of string from oracle db using sql developer.
This is the query that I'm using :
select utl_raw.cast_to_varchar2(dbms_lob.substr(BLOB_COL,2000)) from BLOB_TABLE where BLOB_ID= 997600;
But the output what I get is machine readable format and not text.
Any suggestions on how to change this query?
Run the query, just query the BLOB column.
Double click on the cell.
Check the 'text' value.
Voila.
I am trying to convert a number of type varchar(e.g 1234.456) in to floating point number using oracle function to_number(). In my PC (Locale German) the Oracle SQLDeveloper returning number in the fromat 1234,567 instead of 1234.567 and inturn it is causing the oracle error ORA-01722-invalid number. I cahnged my system locale to en_usa but no use. How can i change the behavior of oracle ?
Help will be greatly appriciated
Try it like this:
SELECT to_number('1234.5678', '9999D9999', 'NLS_NUMERIC_CHARACTERS=.,')
FROM dual;
Here is a fiddle