cool_dude Posted April 1, 2015 Report Posted April 1, 2015 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?
cool_dude Posted April 1, 2015 Author Report Posted April 1, 2015 sCo_^Y sCo_^Y sCo_^Y sCo_^Y sCo_^Y Bhaiyya... Any luck..Entha sepu think sesthav bhaiyya.
KillChillPandey Posted April 1, 2015 Report Posted April 1, 2015 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;
cool_dude Posted April 1, 2015 Author Report Posted April 1, 2015 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
KillChillPandey Posted April 1, 2015 Report Posted April 1, 2015 Bhaiyya I need specifically in sql developer syntax. Date datatype isthe error vastundi variable v_1 number; ila ichi try cheyyi bro
ARYA Posted April 1, 2015 Report Posted April 1, 2015 v_XXX what ever you want declare seyyochu kada man declaration section lo it should work in SQL dev
loveindia Posted April 1, 2015 Report Posted April 1, 2015 Oracle lo datetime unda??? Try timestamp datatype may be... or to_date ani oka conversion function kuda undi. ; use chesava correct ga..??
cool_dude Posted April 1, 2015 Author Report Posted April 1, 2015 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 .?
KillChillPandey Posted April 2, 2015 Report Posted April 2, 2015 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
mtkr Posted April 2, 2015 Report Posted April 2, 2015 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
KillChillPandey Posted April 2, 2015 Report Posted April 2, 2015 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
mtkr Posted April 2, 2015 Report Posted April 2, 2015 highlighted part will give you mutliple row errors..INTO use cheyyali oh..
Recommended Posts