Home » SQL & PL/SQL » SQL & PL/SQL » difference between 'H' and '''H''' (oracle 10g)
difference between 'H' and '''H''' [message #393521] Mon, 23 March 2009 03:59 Go to next message
nezih
Messages: 5
Registered: March 2009
Junior Member
Hello,
I have a function X_FUNC(
pTarih IN DATE,
pMusporturunno IN NUMBER,
pMiktar IN NUMBER,
pFiyat IN NUMBER,
pTip IN VARCHAR2 DEFAULT 'O') RETURN NUMBER
..

when I call
select X_FUNC( TO_DATE('170309','DDMMRR'), 1730, 10000, 2.720101,'''H''')
FROM dual
--Result :1701.2

select f_ode_vergi_bul(TO_DATE('17/03/09'),1730,10000,2.720101,'H')
FROM dual
--Result = 0

Pls. pay attention that the difference..If there is anybody tell me about difference '''H''' and 'H' ..
Re: difference between 'H' and '''H''' [message #393523 is a reply to message #393521] Mon, 23 March 2009 04:02 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
To include a quote in a string, you use two single quotes.
So the string 'H' is passed as '''H'''
Re: difference between 'H' and '''H''' [message #393526 is a reply to message #393521] Mon, 23 March 2009 04:06 Go to previous messageGo to next message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
@nezih,

Don't tell me that you were lazy enough to try it atleast once in SQL* Plus to see the difference?

SQL> SELECT '''H''' FROM Dual;

'''
---
'H'

SQL> SELECT 'H' FROM Dual;

'
-
H

SQL> 


Regards,
Jo
Re: difference between 'H' and '''H''' [message #393528 is a reply to message #393523] Mon, 23 March 2009 04:12 Go to previous messageGo to next message
nezih
Messages: 5
Registered: March 2009
Junior Member
Thank you..
My question is why second select result is 0..Becasue I use 'H' for varchar2...
Re: difference between 'H' and '''H''' [message #393531 is a reply to message #393521] Mon, 23 March 2009 04:17 Go to previous messageGo to next message
nezih
Messages: 5
Registered: March 2009
Junior Member
Please quess this..
a function c_func(x_in varchar2)
How could you this function

c_func('A')
or
c_func('''A''')...

Regards,

Nezih

Re: difference between 'H' and '''H''' [message #393532 is a reply to message #393528] Mon, 23 March 2009 04:18 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
My question is why second select result is 0..Becasue I use 'H' for varchar2...

How could we answer the question when we don't know what's inside your function?
Different parameter value -> different result, whatis so strange?

Regards
Michel
Re: difference between 'H' and '''H''' [message #393537 is a reply to message #393532] Mon, 23 March 2009 04:36 Go to previous messageGo to next message
nezih
Messages: 5
Registered: March 2009
Junior Member
inside function
--
IF pTip = 'H' then
--
stmts..
ELSE
---

Re: difference between 'H' and '''H''' [message #393538 is a reply to message #393521] Mon, 23 March 2009 04:42 Go to previous messageGo to next message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
@nezih,

nezih wrote on Mon, 23 March 2009 14:29

when I call
select X_FUNC( TO_DATE('170309','DDMMRR'), 1730, 10000, 2.720101,'''H''')
FROM dual
--Result :1701.2

select f_ode_vergi_bul(TO_DATE('17/03/09'),1730,10000,2.720101,'H')
FROM dual
--Result = 0

Pls. pay attention that the difference..If there is anybody tell me about difference '''H''' and 'H' ..


1. You are calling two different Functions.

2. Please use a valid TO_DATE Function Format. Don't depend too much on implicit conversion.
SQL> SELECT TO_DATE('17/03/09') FROM Dual;
SELECT TO_DATE('17/03/09') FROM Dual
               *
ERROR at line 1:
ORA-01843: not a valid month


3. Data-wise H is different from 'H'. I already tried it to make you understand it in my previous reply.
Quote:

SQL> SELECT '''H''' FROM Dual;

'''
---
'H'

SQL> SELECT 'H' FROM Dual;

'
-
H

SQL> 




Hope these helps.

Regards,
Jo
Re: difference between 'H' and '''H''' [message #393703 is a reply to message #393521] Tue, 24 March 2009 02:02 Go to previous message
nezih
Messages: 5
Registered: March 2009
Junior Member
Hello,

I solved the problem..The problem is inside function.

No problem because of variable ..

Thanks to everbody..

Previous Topic: how to increment number in left pad if number already exists
Next Topic: find a string in atble
Goto Forum:
  


Current Time: Fri Dec 09 07:37:33 CST 2016

Total time taken to generate the page: 0.08515 seconds