using nvl2 and decoding
Hi Experts,Here, my requirement is if column values is null or zero IT must go to zero if it is to have a value, it must pass value + concat a symbol '%'.
I tried something like this
Select nvl2 (year, concat (year, '%'), 0) in the sale
It manages only null values, when I train with Decode I get ora-01722 error.
someone can help me.
Thank you
KSS.
OK, try:
select CASE WHEN NVL(year,'0') = '0' THEN '0' ELSE concat(year,'%') END val
FROM SALES;
Published by: Seanmacgc on July 15, 2009 04:13
Or:
select CASE WHEN NVL(year,0) = 0 THEN '0' ELSE concat(TO_CHAR(year),'%') END val
FROM SALES;
You should post your data types too.
Tags: Database
Similar Questions
-
Hi, I'm working on the project now.
I use a program that someone else created and change to the new PDA device that is enough for us.
I need to understand how the programmer coded the old way for me so to unstanding how interpetted the code registers 8 memory.
well, from stractch...
This give PDA code 8 memory registers...
I think they are hex and his converts to binary.
There are 26 bits...
the code I will attach take these bits and decode out them...
I don't understand what is happening in this code, so I was hoping that someone can help me by disabling things for.
Propably you can connect the inputs/outputs (or read/write for the globals) of the vi decodeing and then boning with these data.
Felix
-
Hello
I use opennssl for encoding and decoding base 64 and face to face some of the question, he refuses to randomly to encode or decode, to give me a result of 0 and not false BIO_SHOULD_RETRY... I'm trying to put the call in a while if return 0, but it does not work and so I can not decode or encode more...
The code I am using:
uint8_t* Tools::base64(uint8_t *input, uint32_t length) { BIO *bmem, *b64; BUF_MEM *bptr; b64 = BIO_new(BIO_f_base64()); BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); bmem = BIO_new(BIO_s_mem()); b64 = BIO_push(b64, bmem); // write data bool done = false; int res = 0; while(!done) { res = BIO_write(b64, input, length); if(res <= 0) // if failed { if(BIO_should_retry(b64)){ continue; } else // encoding failed { qDebug("error while encoding base64"); done=true; } } else // success! done = true; } // BIO_write(b64, input, length); BIO_flush(b64); BIO_get_mem_ptr(b64, &bptr); uint8_t *buff = (uint8_t *)malloc((bptr->length)+1); memcpy(buff, bptr->data, bptr->length); buff[bptr->length] = 0; BIO_free_all(b64); return buff; } uint32_t Tools::decode64(uint8_t *pInput, uint32_t inputLen, uint8_t ** ppOutput) { BIO *b64, *bmem; uint32_t readLen; (*ppOutput) = (uint8_t *)malloc(inputLen); memset((*ppOutput), 0, inputLen); b64 = BIO_new(BIO_f_base64()); BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); bmem = BIO_new_mem_buf(pInput, inputLen); bmem = BIO_push(b64, bmem); // write data bool done = false; while(!done) { readLen = BIO_read(bmem, (*ppOutput), inputLen); if(readLen <= 0) // if failed { if(BIO_should_retry(b64)){ continue; } else // encoding failed { qDebug("error while decoding base64"); /*int reason; BIO_get_retry_BIO(b64,&reason); qDebug() << "reason of bio bug " << reason;*/ //dont know what to do ;-( done=true; } } else // success! done = true; } BIO_free_all(bmem); return readLen; }
If you have ideas do not hesitate to discuss it!
Thanks in advance!
Try http://qt-project.org/doc/qt-4.8/qbytearray.html#toBase64
-
SQL loader by using functions and position
Hi all, I need help, loading data in my table using sql loader. study the following
If you look at the data, some fields have a lot of * and some af a bit such as *. I want to load data into a table, and when a field contains all * as the value, I want to set to null. If a field contains a * and alphanumeric, so this value should be as it is.CREATE TABLE er ( a1 NUMBER, a2 number, a3 VARCHAR2(100), a4 VARCHAR2(100), a5 VARCHAR2(100), a6 VARCHAR2(100), a7 VARCHAR2(100), a8 VARCHAR2(100) ); OPTIONS (BINDSIZE=20548000, READSIZE=20548000, STREAMSIZE=20548000, DATE_CACHE=25000, SKIP=0) LOAD DATA INTO TABLE er APPEND TRAILING NULLCOLS ( a1 POSITION(0001:0021) , a2 POSITION(0022:0042) "DECODE(SUBSTR(:a2,1,3),'***',NULL,:a2)" , a3 POSITION(0043:0053) , a4 POSITION(0054:0064) , a5 POSITION(0065:0075) , a6 POSITION(0076:0086) , a7 POSITION(0087:0093) "DECODE(SUBSTR(:a7,1,3),'***',NULL,:a7)" ) BEGIN 0.00 ******************** X X X *X **** END;
in the above example, * must be set to null and * should also be defined with a null value. Note that there is a field with x as this area contain alpha numeric, it must be loaded into the table, as is. the only time in field must be set to null, it's when the value contains all .
someone in this forum suggest using to decode, but looks like it doesn't work and I get error when it reads the second field and try to insert into the column number a2.
is it possible to use regular expressions to find out if a field contains all *. I also want to cut each field as they may contain spaces.
can be a help for this, use the ctl sqlloader and above?You can include regular expressions in you SQL * file the charger control.
An example can be found here:
http://www.morganslibrary.org/reference/sqlloader.html
Demos of 7 and 8 by using the UPPER and DECODE functions to illustrate how do. -
Is it possible to send a picture using NetStream and NetConnection?
Would I be able to send an image using NetStream and NetConnection?
Hi mattbanks82 ,
I have not actually tried this before, but I think it can work if you can somehow encode the image as a byte array and send it, and then it receives, you can decode the byte array. There is an as part of the AS3 core lib project http://code.google.com/p/as3corelib/ JPEGEncoder class work that can encode a JPEG image in byte array, but I'm not really sure if it will serve your purpose. Maybe you can consult the documentation for the class to see if it suits your purpose. Otherwise you can consider implementing your own encoder.
Thank you
Abhishek
-
SQL Loader: Help TRIM and Decode functions please
Hello
I have load data from a flat file, for some columns, I need to use the TRIM and DECODE functions. It's a pipe delimited file.
I get a syntax error (one is lower) same error listed for GARNISH.
SQL * Loader-350: at line xx syntax error.
Expected ', 'or') ', found 'DECODE '.
===========
, FINAL_BILL_DATE CHAR (30) "TRIM(:FINAL_BILL_DATE)".
, BUSINESS_ID 'DECODE(:BUSINESS_ID,'B',1,'C',2,'E',3,'G',4,'O',5,'R',6,'T',7,'U',8,'H',9,-1) '.
Can someone please help.
Thank you
JosianeHello josiane.
The error you receive leads me to believe that at some point before the DECODING on the BUSINESS_ID line, probably some line before the FINAL_BILL_DATE line, it is a syntactic error causing the quotes before DECODING actually put an end to some other syntaxes. Without any lines that might actually contribute to this, including details of the header, it's the best I can advise.Hope this helps,
LukePlease check the answer as helpful or response, if it is so. If this is not the case, further clarification.
Try to always provide create table and table insert to help members of the forum to help you. -
data of cutting using substring and instring, and storage in a new table
Hi all
I have an emp_address 2tables, address as below:
---------------------------------------------------------------
create the table emp_address (emp_id varchar2 (10), address varchar2 (100));
Insert into EMP_ADDRESS
(EMP_ID, ADDRESS)
Values
('101', 'street1 fremont CA 94538');
Insert into EMP_ADDRESS
(EMP_ID, ADDRESS)
Values
("102", "Street.2 fremont, CA 94537');
COMMIT;
create the address table (emp_id varchar2 (10), street varchar2 (20), city varchar2 (15), State varchar2 (10), zip varchar2 (10));
-----------------------------------------------------------------------------
Emp_address data as below:
emp_id address
street1 101 fremont CA 94538
102 fremont, CA 94537 Street.2
------------------------------------------------------------------------------
now I read data emp_address and split the data of the address column and record these data in the address table like as below
emp_id Street City State Zip Code
street1 101 fremont, ca 94538
102 fremont, ca 94537 Street.2
-------------------------------------------------------------------
I'm trying to divide these data using substring and instring. Actually my problem was between the data a few times I have 1tab or 2tabs and sometimes 3tab. If the number of tab spaces is not constant.
So can u help me in this case.
Thanks in adavnceposition of reference BluShadow
WITH emp_address AS (SELECT '101' emp_id, 'street1 fremont CA 94538' address FROM DUAL UNION ALL SELECT '102', 'street2 fremont CA 94537' FROM DUAL), emp_address_list_temp AS (SELECT emp_id, SUBSTR ( address, DECODE (LEVEL, 1, 1, INSTR (address, ' ', 1, LEVEL - 1) + 1 ), DECODE ( INSTR (address, ' ', 1, LEVEL), 0, LENGTH (address), INSTR (address, ' ', 1, LEVEL) - DECODE (LEVEL, 1, 0, INSTR (address, ' ', 1, LEVEL - 1) ) - 1 ) ) address, LEVEL rn FROM emp_address CONNECT BY LEVEL <= LENGTH (address) - LENGTH (REPLACE (address, ' ')) + 1 GROUP BY emp_id, address, LEVEL), emp_address_list AS (SELECT emp_id, address, ROW_NUMBER () OVER (PARTITION BY emp_id ORDER BY rn) rn FROM emp_address_list_temp WHERE TRIM (address) IS NOT NULL) SELECT emp_id, (SELECT address FROM emp_address_list e2 WHERE e2.emp_id = e1.emp_id AND rn = 1) street, (SELECT address FROM emp_address_list e2 WHERE e2.emp_id = e1.emp_id AND rn = 2) city, (SELECT address FROM emp_address_list e2 WHERE e2.emp_id = e1.emp_id AND rn = 3) state, (SELECT address FROM emp_address_list e2 WHERE e2.emp_id = e1.emp_id AND rn = 4) zip FROM emp_address_list e1 GROUP BY emp_id
-
That means "use work and movement? ''
When you open the window of information on an album, there is a checkbox for "use work and movement". What does that mean? Feel if you tick the box?
Thank you!
'Work' and 'movement' are designed for orchestral works - so does that music as Beethoven symphonies can be arranged.
-
IPhone 7, there will be an adapter jack allowing the two using headphones AND charger?
IPhone 7, there will be an adapter jack allowing the two using headphones AND charger?
Hello
Apple has not yet announced a.
You can submit your comments and suggestions to Apple here:
-
I do my job to the computer on a MAC book PRO. I want to create a document using Pages and then convert the document to PDF and send a group email. I want to send the PDF using the pdf for each receiver icon must click the icon to open the document. My problem is the document does not show the icon, but rather the document is already open. I spoke with 2 Apple. 'Experts' care and can help me. Can someone tell me what to do?
It's a question of how the recipients e-mail programs deal with attachments. Many e-mail programs will open all the files they can handle, including files jpg and PDF, by default, and if the recipient has not changed that there is nothing you can do about it. The only solution is to the compress first, then it will be delivered as an attachment, allowing the recipient to decompress and open it.
-
I have been using Thunderbird and Firefox for more than 12 months and at that moment there registered for Mozilla Support. Several times during this period, I tried to connect to the Support without success due to 'details' unrecognized and as advised, my email address has been sent, so that a new password can be generated. Each time, Mozilla responded by saying that a link of e-mail had been sent to me to generate a new password. I have never received such an email from Mozilla, so I've never been able to access the media.
I guess that the apparent success today is maybe because of me go a different route to get a valuable source of information. I hope that is correct and have no role in «good luck»Well, you're here now. I have never had such problems myself so it is difficult to know what to say about the difficulties that you had.
And then, what kind of help are you looking for?
-
I do not use sync and am not connected? Why my favorites are synchronization?
My desktop computer has a series of bookmarks that I use at work. My home PC has another, different set of bookmarks that I use at home. I do not use sync and am not connected to sync on each PC. Why my favorites are the synchronization between two PCs? For example, I noticed several bookmarks near the top of my bookmark menu over a line of separation that I do not have to work. I deleted them. I come home and find those missing same bookmarks from my PC at home. I do not want to synchronize anything between the two computers, why what is happening?
Maybe an add-on is the sync these for you.
Refresh (called "Reset" in older versions of Firefox) can solve a lot of problems in restaurant Firefox as his default factory while saving your bookmarks, history, passwords, cookies, and other essential information.
Note: When you use this feature, you will lose all the extensions, toolbar customizations, and certain preferences. See article Firefox Refresh - reset modules and parameters for more information.
Refresh for Firefox:
- Open the troubleshooting information page using one of the following methods:
- Click the menu button
click Help
and select troubleshooting information. Should open a new tab containing your troubleshooting information.
- If you are unable to access the Help menu, type Subject: support in your address bar to bring up the troubleshooting information page.
- Click the menu button
- At the top right of the page, you should see a button that says 'Refresh Firefox' ('reset Firefox' in older versions of Firefox). Click on it.
- Firefox closes. Once the update process is complete, Firefox will display a window with the imported information.
- Click Finish and reopen Firefox.
This corrects the problem? Please report to us!
Thank you.
- Open the troubleshooting information page using one of the following methods:
-
I would like to use Safari AND firefox, how can I achieve this?
For some things that I have to be able to use Safari and would like to know if you can help me to do it without getting rid of Firefox.
Thanks, BneedsWhich browser is currently configured as the default browser?
If Firefox is set as the default browser, then it is possible that the links that open the default browser will now open Firefox.
- https://support.Mozilla.org/KB/how-make-Web-links-open-Firefox-default
- http://KB.mozillazine.org/Default_browser
You may need to reset the default browser Safari.
- Safari > Preferences > general > default Web browser > 'default web browser '.
-
I download my e-mails from gmail to my computer using firefox and only downloads of firefox 3 at a time, not all of them, I. Takes forever.
Sorry, I should have to say that I use Firefox Thunderbird. To automatically download my emails to gmail, but it downloads only 2 or 3 when I did about 50 per day. I have to click again and again. It is on a desktop computer, laptop computer, in fact. My office works very well. Thanks for any help.
-
IMO, request master password dialog box is not well labeled, and its identity (and authentic) seem a little in doubt whenever it appears. It is possible that someone could be spoof using JS and I could unwittingly put my "skeleton key" to a thief? Please tell me I'll be paranoid!
I don't think a script in an ordinary web page has the permission to read your passwords for other Web sites, even if you are not using a master password. It should be limited to see what password manager fills in the page.
For this reason, even if a page has captured your master password, I don't think that he could use it in a harmful way. But I'm maybe not quite devious.
Maybe you are looking for
-
Unable to start using training camp after you have created the new partition
Hello! I recently formatted my macintosh HD partition and reinstalled OS captain. After that, I am unable to boot using boot camp. I still see Bootcamp option in the start menu in the system preferences. All files are visible in the training camp in
-
New Recovery DVD - Rom Windows XP MCE
Anyone know how to get a new dvd - rom windows xp mce recovery? And how much it will cost?Because I'm living in the Brazil, and I bought the laptop in the United Kingdom.Thank´s.
-
Re: Recovery of Tecra T9100 discs
Mr President.IM ndiaye of cochin. My cd of drivers for your laptop's model number missing.my cell phone was THOSHIBA T9100. Please help me. THOSHIBA T9100MODELNO:PT910E - 5XQ1N-G3SERIES NO.53884386GTHOSHIBA EUROPE GMBH
-
How to activate the iPhone that it must first contact the carrier
Dear Sir/Madam, I would like to ask onHowe for help to activate my iPhone 4 it says need to contact the carrier
-
Cannot open the XPS Documents in Vista 64-bit
I have Windows 64 - bit Vista Home Premium installed on my computer. I need to access an XPS document that an employee sent as an attachment, but the file is asking me to choose an application, even when the XPS Viewer is defined as the default openi