Hi all Plz convert this SQL code to ORACLE
-- Insert Not Available Record
set identity_insert Dim_Region on
if not exists ( select 'x' from Dim_Region where Region_Id = 99999 and Region = '#NA#' )
Begin
insert into Dim_Region (Region_Id , Region , Region_Description , Process_Date ) values
(99999 , '#NA#' , 'Not Available' , getdate())
End
set identity_insert Dim_Region off
Hi,
I am not sure what is getdate() I have assumed it to be a function which returns date.
Hopefully this is what you want a Procedure called "identity_insert Dim_Region"
create procedure identity_insert Dim_Region is
cursor c_exists is
select 'x' from Dim_Region where Region_Id = 99999 and Region = '#NA#';
v_var char (1);
v_date date;
begin
open c_exists;
fetch c_exists into v_var;
if c_exists%notfound then
v_date := getdate ();
insert into Dim_Region
(Region_Id , Region , Region_Description , Process_Date )
values
(99999 , '#NA#' , 'Not Available' , v_date);
end if;
close c_exists;
end;Best Regards
Arif Khadas
Similar Messages
-
Plz convert this SQL code to ORALCE
select title,
case when right(title , 2) = 12 then cast(left(title,2) + 1 as varchar(2)) + cast('01' as varchar(2))
else title + 1 end next_title ,
case when right(title,2) = '01' then cast(left(title,2) - 1 as varchar(2)) + cast('12' as varchar(2))
else title - 1 end prev_title
from strdc_admin.st_glt_shipment
group by title
order by titleHi,
Wouldn't it be better if you first explained what this is supposed to do:
select title
,case
when right(title, 2) = 12
then
cast(left(title, 2) + 1 as varchar(2)) + cast('01' as varchar(2))
else
title + 1
end
next_title
,case
when right(title, 2) = '01'
then
cast(left(title, 2) - 1 as varchar(2)) + cast('12' as varchar(2))
else
title - 1
end
prev_title
from strdc_admin.st_glt_shipment
group by title
order by titleI mean, there seems to be some confusion about data types. First you have
when right(title, 2) = 12which indicates title is numeric.
Later on you have
when right(title, 2) = '01'which indicates that title is of char type.
(My guess is that right and left are like substr with positive and negative positions)
Next you have
cast(left(title, 2) + 1 as varchar(2)) + cast('01' as varchar(2))First part, seems to indicate that title is numeric, but what does the second + mean. Is that concatenation?
If not, you have some really confusing implicit type conversions.
And why do you do this:
cast('01' as varchar(2))'01' is already of char datatype, so why cast it?
Please return once you have worked a little more on your question.
Regards
Peter -
hi all,
plz correct this revert back whan i executing every time it will show internal table itab is no long enough.
plz rectify the errirs and send back it.
ABLES: zfm_kfz.
type-pools: slis. "ALV Declarations
*Data Declaration
*TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
*DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
DATA : BEGIN OF ITAB OCCURS 0,
KFZNR LIKE ZFM_KFZ-KFZNR,
GERAET LIKE ZFM_KFZ-KFZNR,
KOSTENTRAEGER(10) TYPE C,
BEZEICHNUNG(10) TYPE C,
TUVDATUMMMYYYY(6) TYPE C,
ASUDATUMMMYYYY(6) TYPE C,
KMSTAND(6) TYPE C,
HISTO(1) TYPE C,
REIFEN(1) TYPE C,
USERNAME(12) TYPE C,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
DATA: T_KFZ LIKE TABLE OF ZFM_KFZ.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'kfznr'.
fieldcatalog-seltext_m = 'kfznr'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 11.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'geraet'.
fieldcatalog-seltext_m = 'geraet'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'kostentraeger'.
fieldcatalog-seltext_m = 'kostentraeger'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'bezeichnung'.
fieldcatalog-seltext_m = 'bezeichnung'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'tuvdatummmyyyy'.
fieldcatalog-seltext_m = 'tuvdatummmyyyy'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'asudatummmyyyy'.
fieldcatalog-seltext_m = 'asudatummmyyyy'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'kmstand'.
fieldcatalog-seltext_m = 'kmstand'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'histo'.
fieldcatalog-seltext_m = 'histo'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 1.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'reifen'.
fieldcatalog-seltext_m = 'reifen'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'username'.
fieldcatalog-seltext_m = 'username'.
fieldcatalog-col_pos = 9.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = itab1
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select * from zfm_kfz
into table itab where kfznr = itab-kfznr.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table itab lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform.
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.Hi,
Change this..
DATA : BEGIN OF ITAB ,
KFZNR LIKE ZFM_KFZ-KFZNR,
GERAET LIKE ZFM_KFZ-KFZNR,
KOSTENTRAEGER(10) TYPE C,
BEZEICHNUNG(10) TYPE C,
TUVDATUMMMYYYY(6) TYPE C,
ASUDATUMMMYYYY(6) TYPE C,
KMSTAND(6) TYPE C,
HISTO(1) TYPE C,
REIFEN(1) TYPE C,
USERNAME(12) TYPE C,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: ITAB_FIELDCAT type SLIS_T_FIELDCAT_ALV .
and also use CAPS for field names.
fieldcatalog-fieldname = '<b>KFZNR</b>'.
fieldcatalog-seltext_m = 'kfznr'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 11.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
Regards
vijay -
Converting application SQL code
I see that the migration workbench will convert stored procedures. Are there any tools that will help to sniff out or convert application SQL code for MS SQL into SQL supported by Oracle. I am converting from SQL Server 7 to Oracle 8i. Any help would be appreciated
Hello,
Yes it probably will return multiple rows...but I spot this:
CURSOR c_schemas IS
select owner from <table>@<db-link> where table_name = 'DDL_LOG' and num_rows > 0 order by owner;
Does that cursor return multiple rows as well? Or just one? Because if it returns more rows you'll get multiple SQL statements...
Good links?? There is APEX documentation in your installation directory...
Just try the different kinds of regions I suggested, see if it works and what fits your needs the best.
Greetings,
Roel
http://roelhartman.blogspot.com/
http://www.bloggingaboutoracle.org/
http://www.logica.com/ -
How do I write this SQL command in Oracle
Hi all
I wriote this SQ L statement in Ms SQL Server. How do I write this sql command in Oracle?
ALTER VIEW dbo.ConsumptionAS SELECT TOP 100 PERCENT ID,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200711' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Nov2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200712' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Dec2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200801' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jan2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200802' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Feb2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200803' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Mar2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200804' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Apr2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200805' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS May2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200806' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jun2008 ,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200807' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jul2008 ,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200808' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS Aug2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200809' AND NbrDaysUsed != 0 THEN (QtyUsed NbrDaysUsed) * 748.05 ELSE 0 END)) AS Sep2008
FROM dbo.MasterConsumption WHERE YEAR_MONTH >= '200710' AND YEAR_MONTH <= '200809' GROUP BY ID ORDER BY ID
I am very interested in this part:
SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007
thanks
Edited by: user631364 on Oct 27, 2008 8:25 AM
Edited by: user631364 on Oct 27, 2008 8:26 AM
Edited by: user631364 on Oct 27, 2008 8:27 AMThank you!!
Now let me aslk the second part of my question.
This sql command:
ALTER VIEW dbo.ConsumptionAS SELECT TOP 100 PERCENT ID,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200711' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Nov2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200712' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Dec2007,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200801' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jan2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200802' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Feb2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200803' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Mar2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200804' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Apr2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200805' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS May2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200806' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jun2008 ,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200807' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jul2008 ,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200808' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS Aug2008,
CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200809' AND NbrDaysUsed != 0 THEN (QtyUsed NbrDaysUsed) * 748.05 ELSE 0 END)) AS Sep2008
FROM dbo.MasterConsumption WHERE YEAR_MONTH >= '200710' AND YEAR_MONTH <= '200809' GROUP BY ID ORDER BY ID
was created with this query in SQL Server and then I saved it in a store procedure, that I scheduled to run montlhy
SET ANSI_NULLS ON
DECLARE @SQLString NVARCHAR(4000)
/* Build the SQL string once.*/
SET @SQLString = 'ALTER VIEW dbo.Consumption AS SELECT TOP 100 PERCENT ID, CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = ' +
"'" + dbo.CONLastMonth_fn(getdate(), month(getdate()) - 12) +
"'" +
' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS ' +
dbo.CONMonthInEnglish(getdate(), month(getdate()) - 12) +
… (GOES FROM current month -12 to current month -1)
, CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = ' +
"'" + dbo.CONLastMonth_fn(getdate(), month(getdate()) - 1) +"'" +
' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS ' +
dbo.CONMonthInEnglish(getdate(), month(getdate()) - 1) +
' FROM dbo.MasterConsumption WHERE YEAR_MONTH >= ' +
"'" + dbo.CONLastMonth_fn (getdate(), month(getdate())-12 ) +"'" +
' AND YEAR_MONTH <= ' +
"'" + dbo.CONLastMonth_fn (getdate(), month(getdate())-1 ) +"'" +
' GROUP BY ID ORDER BY ID '
EXEC sp_executesql @SQLString
Is that something that can be done in Oracle in the same way?
Do you use another approach?
please advice
Edited by: user631364 on Oct 27, 2008 10:19 AM
Edited by: user631364 on Oct 27, 2008 10:21 AM
Edited by: user631364 on Oct 27, 2008 10:21 AM
Edited by: user631364 on Oct 27, 2008 10:22 AM
Edited by: user631364 on Oct 27, 2008 10:23 AM
Edited by: user631364 on Oct 27, 2008 10:23 AM
Edited by: user631364 on Oct 27, 2008 10:24 AM -
Pls convert this piece of SQL code to oracle
Following is the SQL code----
Update reg_dim
set reg_dim.Region_Description = st_reg.Region_Desc ,
reg_dim.Process_Date = sysdate
from st_glt_region st_reg
left join
Dim_Region reg_dim
on st_reg.Region_Abbreviation = reg_dim.Region
where reg_dim.Region is not null
I have tried this in oracle -----
update Dim_region_test set Dim_region_test.REGION_DESCRIPTION = (select st_glt_region.Region_Desc
from st_glt_region left join Dim_region_test
on Dim_region_test.Region=st_glt_region.Region_Abbreviation where Dim_region_test.Region not in null)
group by st_glt_region.Region_Desc;
This is executing but in Dim_region_test, REGION_DESCRIPTION column is empty
Pls help me..................Something like this?
UPDATE reg_dim
SET reg_dim.region_description = st_reg.region_desc,
reg_dim.process_date = (SELECT SYSDATE
FROM st_glt_region st_reg LEFT JOIN dim_region reg_dim
ON st_reg.region_abbreviation = reg_dim.region
WHERE reg_dim.region IS NOT NULL);*009* -
Need help converting this html code into code that will work as a flash button
I have some html code that is for a button in html that when
pressed sends you to a certain url but also somehow adds an 'id
value' and a 'website value'.
How can I convert this code and or put it into a flash
button?
Disregard the gif info...that's just for the html graphic
that goes for the button.
[HTML]<form
action="https://secure.verotel.com/cgi-bin/vtjp.pl"
method="post">
<input type=hidden name=verotel_id
value="9804000000840231">
<input type=hidden name=verotel_website value="55461">
<center>
<input type="image" src="
http://buttons.verotel.com/join/button_00010155461.gif"
alt="Signup NOW!">
<img src="
http://buttons.verotel.com/signup/tbutton_55461.gif"
border="0" width="1" height="1" alt="">
</center>
</form>[/HTML]What you want to do might look something like this:
-
Converting T-SQL proc into Oracle
I need help in converting the following stored procedure into PL/SQL code. Basically I need to know corresponding function names for the various T-SQL constructs below. The parameter @PROC_NUM is passed by the caller with value @@PROCID which is the T-SQL global variable for the ID of the current stored procedure being executed by SQL Server. Thanks in advance for all the help.
CREATE PROCEDURE [dbo].MARS_MPPM_HANDLE_ERROR
@PROC_NUM INT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @ERROR_NUMBER INT
DECLARE @ERROR_SEVERITY INT
DECLARE @ERROR_STATE INT
DECLARE @ERROR_PROCEDURE Varchar(1000)
DECLARE @ERROR_LINE INT
DECLARE @ERROR_MESSAGE Varchar(8000)
DECLARE @PROC_NAME Varchar(255)
SELECT
@ERROR_NUMBER = ERROR_NUMBER(),
@ERROR_SEVERITY = ERROR_SEVERITY(),
@ERROR_STATE = ERROR_STATE(),
@ERROR_PROCEDURE = ERROR_PROCEDURE(),
@ERROR_LINE = ERROR_LINE(),
@ERROR_MESSAGE = ERROR_MESSAGE(),
@PROC_NAME = OBJECT_NAME( @PROC_NUM )
IF 50000 = @ERROR_NUMBER
BEGIN
RAISERROR( '%s -> %s', 16, 1, @PROC_NAME, @ERROR_MESSAGE )
END
ELSE
BEGIN
RAISERROR( '%s -> Error Number = %d, Error Severity = %d, Error State = %d, Error Procedure = %s, Error Line = %d, Error Message = %s',
16,
1,
@PROC_NAME,
@ERROR_NUMBER,
@ERROR_SEVERITY,
@ERROR_STATE,
@ERROR_PROCEDURE,
@ERROR_LINE,
@ERROR_MESSAGE )
END
END875311 wrote:
I need help in converting the following stored procedure into PL/SQL code.
Re: How can i rewrite this code into java?
This is true of any language, to adapt to this case
1) Learn T-SQL
2) Understand what that code does, that is, what its job is.
3) Learn PL/SQL.
4) Write PL/SQL code that fulfills the requirements fleshed out in step 2.
The absolutely wrong way to do it is to try a mindless, mechanical translation.
Re: How can i rewrite this code into java?
>
Seriously, you need to go through a Java tutorial from the beginning. Just trying to force another language's syntax onto Java without actually understanding anything about Java, and then posting questions here when you get stuck--questions that you could have and should have answered by doing the tutoria--is a horrible approach.
>
Replace Java with PL/SQL for same answer.
Getting started with PL/SQL
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10766/toc.htm
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.htm
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/toc.htm -
Convert MS SQL 2000 to Oracle 9i
Hi,
I am a newbie in Oracle, I need to convert my current MS SQL 2000 db to Oracle 9i. My current db has about 200 tables with no stored procedures. So I need to convert the db design and data.
I read from this forum, some suggested to use Oracle Migration Workbench, some suggested Enterprise Manager Console with the Load Wizard.
How can I do the migration and where can I download the migration tools if any?
Regards,
JentyDTS is also buggy which is why SQL Server 2005 has a complete rewrite of the feature.
Nevertheless for straight data dumps Jim is correct in that DTS should work.
For getting the DDL you might consider using Query Analyzer to just dump all the DDL into a file and then using C or a script language to extract and convert the SQL into Oracle DDL. If you are a good script (maybe Perl) coder this would be just as quick as setting up and using the conversion tool.
Once you have the tables defined to Oracle you can use a little pl/sql to generate the sqlldr control cards to pull in the DTS extracted data.
Or you can use the ability of SQL Server to access Oracle by define a remote db and insert all the data accross. You will need to install an Oracle client on the SQL Server box to do this.
You have plently of options. Look them all over and go with the one that best matches your available skill set.
HTH -- Mark D Powell -- -
Convert java.sql.Date to oracle.jbo.domain.Date in oaf
Hi,
Need to dafault NeedBydate(i get in from query as below) to a messagelovinput and make it read only.
i am facing some issue in converting from java.sql.Date to oracle.jbo.domain.Date.
unable to figure out the problem.
below is the sample code im trying to use.
PreparedStatement ps=pageContext.createPreparedStatement("select sysdate from dual");
ResultSet rs=ps.executeQuery();
if (rs!=null && ps.next()
java.sql.Date sqlDate= rs.getDate(1);
oracle.jbo.domain.Date oracleDate = new oracle.jbo.domain.Date(sqlDate.getTime());
vorow.setAttribute("Datevalue",oracleDate);
this is my assumption : to set to UI i need date in format dd-Mon-yyyy.(am i correct? as to get that format i tried to use simple date format class but no use)
when i tried to use simple date format :unpaseable date exception was raised.
please guide.Hi,
Why are you using this code???
PreparedStatement ps=pageContext.createPreparedStatement("select sysdate from dual");
ResultSet rs=ps.executeQuery();
if (rs!=null && ps.next()
java.sql.Date sqlDate= rs.getDate(1);
oracle.jbo.domain.Date oracleDate = new oracle.jbo.domain.Date(sqlDate.getTime());
you can get sysdate using this and then set it
oracle.jbo.domain.Date currentDate = am.getOADBTransaction().getCurrentUserDate();
java.text.SimpleDateFormat displayDateFormat = new java.text.SimpleDateFormat ("yyyy-MM-dd");
String DateForm = displayDateFormat.format(currentDate.dateValue());
oracle.jbo.domain.Date dateset = new oracle.jbo.domain.Date(DateForm);
and then set the attribute
vorow.setAttribute("Datevalue",dateset);
Thanks,
Gaurav -
How to conver this sqlserver code into Oracle
Hi,
Any one can help me how to covert below sqlserver code into Oracle?
DECLARE @t1 DATETIME;
DECLARE @t2 DATETIME;
SET @t1 = GETDATE();
select * from table;
SET @t2 = GETDATE();
SELECT DATEDIFF(millisecond,@t1,@t2) AS elapsed_ms;Hi,
Do Like This ,
This is The function going to calculate elapsed time ,execute this before the second script,
CREATE function DATEDIFF
startTime in timestamp with time zone,
endTime in timestamp with time zone
return number
as
interval_ interval day (9) to second (3);
begin
interval_ := endTime - startTime;
return (extract(day from (interval_)) * 86400 +
extract(hour from (interval_)) * 3600 +
extract(minute from (interval_)) * 60 +
extract(second from (interval_))) * 1000;
end;And this Is the Script that i converted to oracle,
SET server out put on;
DECLARE
v_t1 TIMESTAMP;
v_t2 TIMESTAMP;
lv_cur sys_refcursor;
lv_elapsed VARCHAR2 (30);
BEGIN
v_t1 := SYSTIMESTAMP;
OPEN lv_cur FOR
SELECT *
FROM emp;
v_t2 := SYSTIMESTAMP;
SELECT datediff (v_t1, v_t2) elapsed_ms
INTO lv_elapsed
FROM DUAL;
DBMS_OUTPUT.put_line (v_t1);
DBMS_OUTPUT.put_line (v_t2);
END;Thanks & Rgds
BCV. -
How to convert pl/sql code into java/j2ee
Hi,
We have a PL/SQL Oracle App server application that we will support if we can convert in j2ee/java. But when i did take a look at the code, these pl/sql contains all HTML and java code inside the stored procedures.
And iam looking to explore some tools and mechanisms that can convert these pl/sql in a JAVA application so that i can deploy this new app into my BEA81 environment.
Does any body has any idea:
a) How to convert from pl/sql > java ?
b) Any plugins or tools of BEA that can run these pl/sql (the way thay are currently...i.e w/o converting) in BEA 81 container ?
thanks, sangitathese pl/sql contains all HTML and java code insideJava or JavaScript. They are not the same. I wouldn't expect to see Java inside html, whereas JavaScript would be intermixed. On the other hand you might have a java stored proc (Oracle 9/10) which is generating HTML.
>
Does any body has any idea:Refactor.
I doubt it just has html and JavaScript/Java. So what you have is a mess that mixes several things that should have been seperate in the first place. -
How to convert this SQL query to PL/SQL
I basically need to create an anonymous block that will display each student's first name, last name and the count of students who scored less on test 1 than the student.
So basically we need to find the count of students who have scored less than that particular student and we do it for all students in the table.
So for this particular query i designed my code in SQL
select g1.gr_fname, g1.gr_lname, count(*)
from grade g1, grade g2
where g1.gr_t1 > g2.gr_t1 and
g1.std_code = g2.std_code
group by g1.gr_fname, g1.gr_lname;
But i am unable to get the logic as to how to execute it in PL/SQL,I am missing something a minor detail to execute the same in PL/SQL
could someone please help me with the logic.
ThanksHi welcome to the forum try some thing below
SQL> DECLARE
2 CURSOR c1
3 IS
4 SELECT ename, sal, d.deptno
5 FROM scott.emp e, scott.dept d
6 WHERE e.deptno = d.deptno
7 GROUP BY ename, sal, d.deptno;
8 BEGIN
9 FOR c2 IN c1
10 LOOP
11 DBMS_OUTPUT.put_line ('name is ' || c2.ename);
12 END LOOP;
13 END;
14 /
name is CLARK
name is KING
name is JONES
name is MARTIN
name is FORD
name is SCOTT
name is ALLEN
name is TURNER
name is WARD
name is MILLER
name is ADAMS
name is BLAKE
name is JAMES
name is SMITH
PL/SQL procedure successfully completed.This is just to demonstrate the use of PL/SQL block -
Trying to convert this sql into a crystal report
Post Author: ru4real
CA Forum: General
I have this statement provided to extract via sql but i cannot emulate this in crystal. can anybody help? here is the run down. essentially iam trying to list records in one table auanmast which is not present in the other table auanregs based on reg dte (from) and reg til (to) if this record is not in the auanreg table then list the ani_num from the auanmast. (however there is not a null field present in the auanreg table), so a left outerjoin won't work.
ani_num reg_date reg_til
5555 01/07/08 30/06/09
5555 01/07/05 30/07/06
so the record missing in auanreg is reg_date 01/07/07 and reg_til = 30/06/08 and iam trying to get the query to list all ani_num from auanmast that have no date assigned with reg_date & reg_til date the link being ani_num to
select ani_num from auanmast a where ani_num not in (select ani_num from auanregs where reg_dte = '01-Jul-07' and reg_til = '30-Jun-08' and ani_num = a.ani_num) and ani_dth is null and ani_dep is null and ani_num not in (select ani_num from auantags where ani_num = a.ani_num and tag_set != '2007/08') order by ani_num /
Hope someone is upto the challenge for this one....cheersPost Author: V361
CA Forum: General
Have you tried adding a command. Go to select datasource, select command, you should be able to use the SQL there. ( OF course it won't be just copy and paste ) unless you are lucky. -
Convert this sql server query to Oracle?
I've some SQL Server queries that I need to make a copy for to run against Oracle databases. (10G), any help would be appreciated.
SELECT COUNT(*) COUNT, CONVERT(DATETIME, CONVERT(VARCHAR(8), M.START_DATE, 1)) [DATE]
FROM OPTC.ORD_M_ORDER M
INNER JOIN OGEN.GEN_M_PATIENT_MAST P ON M.PAT_NUMBER = P.PAT_NUMBER
INNER JOIN OPTC.ORD_C_ORDER_TYPE C ON C.ORDER_TYPE_KEY = M.ORDER_TYPE_KEY
WHERE OGEN.DATEONLY(END_DATE)- OGEN.DATEONLY(START_DATE) < '1900/03/01'
--AND OGEN.DATEONLY(CREATED_ON) = OGEN.DATEONLY(CURRENT_TIMESTAMP)
AND ORDER_STATUS IN (4,7,8)
AND M.FACILITY_KEY IN (SELECT VALUE FROM OGEN.COMMA_TO_TABLE(@FACILITYKEY))
AND [START_DATE] BETWEEN @STARTDATE AND @ENDDATE
AND CAST(M.ORDER_FLAGS AS BIGINT) & 64 <> 64 AND P.DISCHARGE_DATE IS NULL
GROUP BY CONVERT(DATETIME, CONVERT(VARCHAR(8), [START_DATE], 1))Hi,
You could use the 'Translation Scratch Editor' in SQL*Developer to translate SQL*Server statements to Oracle.
SQL*Developer is free and can be downloaded from here -
http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html
Once installed start it up, then go to 'Tools' - 'Migration' - 'Translation Scratch Editor'
I did run the statement you have posted here through it but it gave errors so looks like there may be a problem with the syntx in any case.
Does this query run as it is in SQL*Server ?
Regards,
Mike
Edited by: mkirtley on Jan 5, 2012 12:45 PM
Maybe you are looking for
-
HT5517 Is there a way to select multiple speakers from my ATV3?
I have ATV3, an iPad2, a Sony Vaio laptop and another audio system connected to my WiFi network via an Airport Express. Via ATV I can only select one speaker / output at a time (i.e. EITHER Airport Express OR ATV). When I have a party in the house (
-
Can I perform a Time Machine backup to a USB drive connected to the Time Capsule 3TB
I would like to perform Time Machine backups to a portable USB drive, to use as an off-site backup copy. However, when I plug the drive into the Time Capsule (3TB) it isn't seen by Time Machine from any of the computers on my network. What do I ne
-
Hi, Is there is any standard report in SAP that shows how much we have purchased, how much GR is done & how much is still balance from a particluar vendor/s (not like ME2M,ME3M etc. report).The report should be downloadable. I tried the report MC$4
-
Bad pointer exception in Debug mode.. CView in CDockable pane MFC Feature pack
Hi I have attached a CView in CDockablePane and it works fine in Release mode but it throws bad memory pointer in debug mode while closing the application.(Crashing during close). Please advise... Find the code below how I had attached the View to D
-
Hi all, I need to monitor every CE which belongs to different VRF, their IP address may be overlapping. Is there any good idea to do that. Thanks.