Jump to content

Recommended Posts

Posted

Mammolga SQL server lo ayithe I do the following

DECLARE @Date DATE
SELECT @Date=Max(date) from table1

Final Output

SELECT * From Table2
WHERE date=@Date

But in the same way ORACLE PL/SQL ( Esp in SQL Developer ) , How can I declare the Variable?


Kindly Advise and help please?

Posted

sCo_^Y sCo_^Y sCo_^Y sCo_^Y sCo_^Y


Bhaiyya... Any luck..Entha sepu think sesthav bhaiyya.
Posted

Mammolga SQL server lo ayithe I do the following

DECLARE @Date DATE
SELECT @Date=Max(date) from table1

Final Output

SELECT * From Table2
WHERE date=@Date

But in the same way ORACLE PL/SQL ( Esp in SQL Developer ) , How can I declare the Variable?


Kindly Advise and help please?

 

variable declaration antey  autonomous script lo :

 

V_variable number ;   -- variable data type

v_variable2 varchar2(100) -- string

v_date   DATE ;

 

begin

 -- Your logic here

 

end;

Posted

variable declaration antey autonomous script lo :

V_variable number ; -- variable data type
v_variable2 varchar2(100) -- string
v_date DATE ;

begin
-- Your logic here

end;


Bhaiyya I need specifically in sql developer syntax. Date datatype isthe error vastundi
Posted

Bhaiyya I need specifically in sql developer syntax. Date datatype isthe error vastundi

 

 

variable v_1 number;

 

ila ichi try cheyyi bro

Posted

v_XXX what ever you want declare seyyochu kada man declaration section lo it should work in SQL dev

Posted

Oracle lo datetime unda??? Try timestamp datatype may be... or to_date ani oka conversion function kuda undi. ; use chesava correct ga..??

Posted

Oracle lo datetime unda??? Try timestamp datatype may be... or to_date ani oka conversion function kuda undi. ; use chesava correct ga..??

 

Thank You Bhaiyya. yes TO_DATE vadanu ippudu. Now  I'm almost closer to it.

 

Here is the Syntax I am using

 

variable var TO_DATE

exec select max(post_date) into :var from table1;

 

select *

  from TABLE2

 where post_date = :var

 

But RUN chesetappudu Its prompting the DIALOG box to Enter Date. Results automatic ga run avvali kadha bhaiyya .?

 

 

 

Posted

Oracle lo datetime unda??? Try timestamp datatype may be... or to_date ani oka conversion function kuda undi. ; use chesava correct ga..??

 

 

conversion function variable declaration appudu vadtara?? i thought we can use while assigning like below:

 

declare

 

v_var date := to_date or to_Char depending on what you have 

 

begin

--

end;

 

or

 

declare 

 

v_var date;

 

begin

 

v_var = to_Date (v_var, MMDDYYYY);

 

end

Posted

some thng lyk..

 

 declare

v_var date;

 

begin

select max(date) into v_var from table1;

begin

select * from table2 where date in (:v_var);

end;

end;

 

sSa_j@il

Posted

some thng lyk..

 

 declare

v_var date;

 

begin

select max(date) into v_var from table1;

begin

select * from table2 where date in (:v_var);

end;

end;

 

sSa_j@il

 

 

highlighted part will give you  mutliple row errors..INTO use cheyyali

Posted

highlighted part will give you  mutliple row errors..INTO use cheyyali

 

oh..

×
×
  • Create New...