Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connecting remote DB without TNS file or oracle client

HeshMay 13 2015 — edited May 14 2015

Hi,

DB version : Oracle Database 11g Enterprise Edition Release 11.2.0.4.0

Can I connect to the remote DB without TNS file or oracle client installed in my machine?

I tried with Basic Connection type but no luch getting following error...

status: Failure : IO Error : The Network Adapter could not establish  the connection

Please help.

Thanks,

Hesh

Comments

561093
create or replace function ean_13(P_Str In Varchar2) Return Varchar2 Is
l_Sum Number;
l_Multiple Number;
Begin
For I in 1..12 Loop
If mod(i,2) = 0 Then
l_Multiple := 3;
Else
l_Multiple := 1;
End If;

l_Sum := Nvl(l_Sum, 0) + Substr(P_Str, i, 1) * l_Multiple;
End Loop;
If Floor(l_Sum/10) - Mod(l_Sum, 10) = Substr(P_Str, 13) Then
Return('TRUE');
Else
Return('FALSE');
End If;
End;
/


SQL> select ean_13('2741023456884') from dual;

EAN_13('2741023456884')
-------------------------------------------------------
TRUE

SQL> select ean_13('2741023456881') from dual;

EAN_13('2741023456881')
-------------------------------------------------------
FALSE
547235
Thanks for you prompt response,

why it does not work for the following:
2741012605644
2741012605651
2741000000017
it returns false.
561093
create or replace function ean_13(P_Str In Varchar2) Return Varchar2 Is
l_Sum Number;
l_Multiple Number;
Begin
For I in 1..12 Loop
If mod(i,2) = 0 Then
l_Multiple := 3;
Else
l_Multiple := 1;
End If;

l_Sum := Nvl(l_Sum, 0) + Substr(P_Str, i, 1) * l_Multiple;
End Loop;

If 10 - Mod(l_Sum, 10) = Substr(P_Str, 13) Then
Return('TRUE');
Else
Return('FALSE');
End If;
End;
/


SQL> select ean_13('2741012605644') from dual;

EAN_13('2741012605644')
------------------------------------------------
TRUE


SQL> select ean_13('2741012605651') from dual;

EAN_13('2741012605651')
--------------------------------------------------
TRUE


SQL> select ean_13('2741000000017') from dual;

EAN_13('2741000000017')
------------------------------------------------
TRUE
547235
THANKS BUDDY...YOU SAVED MY DAY
547235
HI CITRUS,

DO YOU HAVE THE OUTPUT PROCEDURE FOR GENERATING TEXT FILE FOR THE AIRMILES PROGRAMME

THANKS.
572471
SQL> with t as (select '2741023456884' str from dual)
  2  --
  3  select decode(substr(10 - mod(sum(substr(str, level, 1) *
  4                             decode(mod(level, 2), 1, 1, 3)),
  5                         10),-1,1),
  6                substr(str, -1, 1),
  7                'TRUE',
  8                'FALSE')
  9    from t
 10  connect by level < length(str)
 11  /

DECODE(SUBSTR(10-MOD(SUM(SUBST
------------------------------
TRUE

SQL> 
547235
thanks volder
1 - 7
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 11 2015
Added on May 13 2015
15 comments
345 views