Migrating from mysql to oracle 12c - oracle12c

I'm migrating from MySQL to oracle i got the script generated on MySQL and when creating a view MySQL add this:
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "TB"
Begin Extent =
Top = 6
Left = 38
Bottom = 114
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
I have created the view with no problem on oracle
but since i´m new on oracle i don't know if this code is necessary or its just necessary on MySQL, if it is necessary how can i get it done on oracle?

This code looks like the extended properties for SQL Server Management Studio (SSMS) which are added to the view so your GUI Design layout will be loaded again if you open that view again in the GUI - but you said you are doing MySQL to Oracle not SQL Server to Oracle so not sure why you are using SSMS.
This isn't required for the view to work (in any database) only to set the layout of the designer view in SSMS so there is no need to add it into your Oracle view.
If you use Tasks -> Generate Scripts to export your VIEW code via SSMS you can disable scripting of extended properties in the Advanced Options by setting Script Extended Properties to false.

Related

while loop in my program does not fill the second row

I have 2 inner while loops. Code writes the results to first row on the matrix but when it gets to second row, it just passes the other rows and doesn't fill the columns of the rows. How to solve it? The code and output are like below:
while i <= m-1
i
while a <= m-1
a
den1 = sqrt(((xy{i,j}-xy{a+1,b})^2+(xy{i,j+1}-xy{a+1,b+1})^2 ));
dMat(i,a) = den1;
a = a+1;
end
i = i+1;
end
i = 1
a = 1
a = 2
a = 3
a = 4
a = 5
a = 6
a = 7
a = 8
a = 9
a = 10
a = 11
a = 12
a = 13
a = 14
a = 15
a = 16
a = 17
a = 18
a = 19
a = 20
a = 21
a = 22
a = 23
a = 24
i = 2
i = 3
i = 4
i = 5
i = 6
i = 7
i = 8
i = 9
i = 10
i = 11
i = 12
i = 13
i = 14
i = 15
i = 16
i = 17
i = 18
i = 19
i = 20
i = 21
i = 22
i = 23
i = 24
You have to restart a to a=1 for each iteration. Put it above the while a <= m-1

How do I get microsoft word or pycharm to read dot files as a graphic instead of code

When I open my .dot file with microsoft word or pycharm it shows me the code and that the code is error free but doesnt display the intended graphic.
I have extensively searched on google for a solution but google insists that microsoft word comes with the ability to read .dot files (which it seems to be able to read the code but not display the graphic). I downloaded the pycharm .dot reading plug-in and now pycharm can read the code and it says that the code is error free, but again it does not display the graphic.
I am unsure what code is necessary so I am just giving the whole thing.
digraph Tree {
node [shape=box, style="filled, rounded", color="black", fontname=helvetica] ;
edge [fontname=helvetica] ;
0 [label="failures <= 0.5\nsamples = 100.0%\nvalue = [0.502, 0.498]\nclass = fail", fillcolor="#e5813902"] ;
1 [label="higher_no <= 0.5\nsamples = 84.8%\nvalue = [0.422, 0.578]\nclass = pass", fillcolor="#399de545"] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="school_GP <= 0.5\nsamples = 79.2%\nvalue = [0.386, 0.614]\nclass = pass", fillcolor="#399de55e"] ;
1 -> 2 ;
3 [label="absences <= 1.5\nsamples = 23.0%\nvalue = [0.574, 0.426]\nclass = fail", fillcolor="#e5813942"] ;
2 -> 3 ;
4 [label="freetime <= 4.5\nsamples = 12.4%\nvalue = [0.419, 0.581]\nclass = pass", fillcolor="#399de547"] ;
3 -> 4 ;
5 [label="samples = 11.6%\nvalue = [0.379, 0.621]\nclass = pass", fillcolor="#399de563"] ;
4 -> 5 ;
6 [label="samples = 0.8%\nvalue = [1.0, 0.0]\nclass = fail", fillcolor="#e58139ff"] ;
4 -> 6 ;
7 [label="health <= 1.5\nsamples = 10.6%\nvalue = [0.755, 0.245]\nclass = fail", fillcolor="#e58139ac"] ;
3 -> 7 ;
8 [label="samples = 2.2%\nvalue = [0.455, 0.545]\nclass = pass", fillcolor="#399de52a"] ;
7 -> 8 ;
9 [label="samples = 8.4%\nvalue = [0.833, 0.167]\nclass = fail", fillcolor="#e58139cc"] ;
7 -> 9 ;
10 [label="Walc <= 3.5\nsamples = 56.2%\nvalue = [0.31, 0.69]\nclass = pass", fillcolor="#399de58d"] ;
2 -> 10 ;
11 [label="Medu <= 3.5\nsamples = 46.4%\nvalue = [0.263, 0.737]\nclass = pass", fillcolor="#399de5a4"] ;
10 -> 11 ;
12 [label="samples = 29.4%\nvalue = [0.333, 0.667]\nclass = pass", fillcolor="#399de57f"] ;
11 -> 12 ;
13 [label="samples = 17.0%\nvalue = [0.141, 0.859]\nclass = pass", fillcolor="#399de5d5"] ;
11 -> 13 ;
14 [label="sex_M <= 0.5\nsamples = 9.8%\nvalue = [0.531, 0.469]\nclass = fail", fillcolor="#e581391d"] ;
10 -> 14 ;
15 [label="samples = 3.0%\nvalue = [0.267, 0.733]\nclass = pass", fillcolor="#399de5a2"] ;
14 -> 15 ;
16 [label="samples = 6.8%\nvalue = [0.647, 0.353]\nclass = fail", fillcolor="#e5813974"] ;
14 -> 16 ;
17 [label="reason_course <= 0.5\nsamples = 5.6%\nvalue = [0.929, 0.071]\nclass = fail", fillcolor="#e58139eb"] ;
1 -> 17 ;
18 [label="health <= 3.5\nsamples = 2.6%\nvalue = [0.846, 0.154]\nclass = fail", fillcolor="#e58139d1"] ;
17 -> 18 ;
19 [label="samples = 1.4%\nvalue = [1.0, 0.0]\nclass = fail", fillcolor="#e58139ff"] ;
18 -> 19 ;
20 [label="reason_home <= 0.5\nsamples = 1.2%\nvalue = [0.667, 0.333]\nclass = fail", fillcolor="#e581397f"] ;
18 -> 20 ;
21 [label="samples = 0.6%\nvalue = [0.333, 0.667]\nclass = pass", fillcolor="#399de57f"] ;
20 -> 21 ;
22 [label="samples = 0.6%\nvalue = [1.0, 0.0]\nclass = fail", fillcolor="#e58139ff"] ;
20 -> 22 ;
23 [label="samples = 3.0%\nvalue = [1.0, 0.0]\nclass = fail", fillcolor="#e58139ff"] ;
17 -> 23 ;
24 [label="Fjob_teacher <= 0.5\nsamples = 15.2%\nvalue = [0.947, 0.053]\nclass = fail", fillcolor="#e58139f1"] ;
0 -> 24 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
25 [label="Fjob_health <= 0.5\nsamples = 15.0%\nvalue = [0.96, 0.04]\nclass = fail", fillcolor="#e58139f4"] ;
24 -> 25 ;
26 [label="freetime <= 1.5\nsamples = 14.8%\nvalue = [0.973, 0.027]\nclass = fail", fillcolor="#e58139f8"] ;
25 -> 26 ;
27 [label="Mjob_at_home <= 0.5\nsamples = 0.6%\nvalue = [0.667, 0.333]\nclass = fail", fillcolor="#e581397f"] ;
26 -> 27 ;
28 [label="samples = 0.2%\nvalue = [0.0, 1.0]\nclass = pass", fillcolor="#399de5ff"] ;
27 -> 28 ;
29 [label="samples = 0.4%\nvalue = [1.0, 0.0]\nclass = fail", fillcolor="#e58139ff"] ;
27 -> 29 ;
30 [label="age <= 16.5\nsamples = 14.2%\nvalue = [0.986, 0.014]\nclass = fail", fillcolor="#e58139fb"] ;
26 -> 30 ;
31 [label="samples = 2.4%\nvalue = [0.917, 0.083]\nclass = fail", fillcolor="#e58139e8"] ;
30 -> 31 ;
32 [label="samples = 11.8%\nvalue = [1.0, 0.0]\nclass = fail", fillcolor="#e58139ff"] ;
30 -> 32 ;
33 [label="samples = 0.2%\nvalue = [0.0, 1.0]\nclass = pass", fillcolor="#399de5ff"] ;
25 -> 33 ;
34 [label="samples = 0.2%\nvalue = [0.0, 1.0]\nclass = pass", fillcolor="#399de5ff"] ;
24 -> 34 ;
}
I expect the above code to display a color-coded decision tree. Instead microsoft word, pycharm, and jupyter notebook are all returning the code.
A GraphViz .dot file is not an image file. It rather contains a logical description of some content (nodes and edges), along with some graphical clues how to display them (e.g. color, font sizes). The exact positions of each element are not defined in the .dot file at all. Calculating these positions, and rendering actual image files, is left to a layout engine, such as dot, or derived Javascript libraries (e.g. viz.js).
Almost no application can display GraphViz .dot files directly.
The confusion probably comes from a conflicting naming convention:
GraphViz .dot file (what we are talking about here)
Microsoft .dot file (what Word is expecting and Google might refer to)
A Microsoft .dot file is a template for a Microsoft Word (.doc) file.
In order to present your desired graphic, you need to run your .dot file through a layout engine to produce e.g. an .svg or .png file.
You can do this manually on your local PC or online (e.g. https://dreampuf.github.io/GraphvizOnline/ ), then save the resulting image.
You can present both .svg and .png images in Word (Insert / Image).
I have been able to get the .dot file to open properly using GVEdit (graphviz text editor). Here is a link to a post that answers my question. Graphviz: How to go from .dot to a graph?
Don't try to open dot file directly from word as it will give an error. Open Ms-word first then locate the dot file which you want to open.

Dynamic window forming in efficient way in MATLAB

Can someone help me to provide an efficient way or help me to perform the provide code to do make same results in minimal possible steps. I shall be grateful to you.
I have an Original Array:
A = [1 1 1 4.3 4.5 4 4.3 3 1 0 0 2 6.2 6.3 6 6.2 7.4 8 7.2 2 2 3 3 2];
Output Looks like:
A = [1 1 1 4 4 4 4 3 1 0 0 2 6 6 6 6 6 7 7 2 2 3 3 2];
I apply some restrictions and removed some values from array of local maxima’s after that I received some new arrays.
Yposlocfiltered = [6 15 23];
idx = [4 6 3];
Yneglocfiltered = [2 9 20];
idx_neg = [1 1 2];
Where I will find idx(local maxima value) I will check if values behind and ahead are greater make a window.
Example
If I will find 4 and 4.5, 4.3 is greater than 4 include it in backward window
4.3 is greater than 4 include it in forward window.
I need to find range of values behind local maxima and ahead local maxima.
I have tried to write a code that’s works fine but issue is that it’s too long.
Can someone please provide me an idea to perform this action in minimal steps and in faster ways?
I have only provided code for positive local maxima’s as for negative local maxima code Is just replica of this.
Code:only for positive local maximas
clc
clear all
A = [1 0 1 4.3 4.5 5 4.3 3 0 0 0 2 6.2 6.3 7 6.2 7.4 8 7.2 1 2 3 4 2];
Yposlocfiltered = [ 6 15 23];
idx = [4 6 3];
Yneglocfiltered = [2 9 20];
idx_neg = [1 1 2];
for b = 1: numel(idx)
for c = 1:numel(A)
f = Yposlocfiltered(1,b)-c ;
g = Yposlocfiltered(1,b)+c ;
% if (f > 0 && g <= numel(X))
if(f > 0)
if (A(Yposlocfiltered(1,b)-c))> idx(1,b)
else
d= f+1;
z(b)= d;
backward_window = z;
break
end
end
end
end
for r = 1: numel(idx)
for s = 1:numel(A)
u = Yposlocfiltered(1,r)-s ;
v = Yposlocfiltered(1,r)+s ;
% if (f > 0 && g <= numel(X))
if(v <=numel(A))
if (A(Yposlocfiltered(1,r)+s))> idx(1,r)
else
w= v-1;
y(r)= w;
forward_window = y;
break
end
end
end
end
n=4
for i=1:length(backward_window)
range = backward_window(i): forward_window(i);
p = range
if n <= numel(p)
p = range(1:n)
A( p) = idx(i);
else
% if (size(range)<= 3)
A( p) = idx(i);
end
end
From the first look at your code, I believe you can combine your first two for loops into one.
sA = numel(A);
sI = numel(idx);
for i = 1:sI
f = Yposlocfiltered(i) - [1:sA];
g = Yposlocfiltered(i) + [1:sA];
f(f<1) = [];
g(g>sA) = [];
backward_window(i) = f(find(A(f) <= idx(i), 1)) + 1;
forward_window(i) = g(find(A(g) <= idx(i), 1)) - 1;
end
Here, you can use find to locate the element of an array matching the specified condition, i.e. g <= numel(X) or A(f) <= idx(i).
Your last loop which modifies A can also be integrated into the same loop, so you can have:
sA = numel(A);
sI = numel(idx);
n=4;
for i = 1:sI
f = Yposlocfiltered(i) - [1:sA];
g = Yposlocfiltered(i) + [1:sA];
f(f<1) = [];
g(g>sA) = [];
backward_window(i) = f(find(A(f) <= idx(i), 1)) + 1;
forward_window(i) = g(find(A(g) <= idx(i), 1)) - 1;
range = backward_window(i) : forward_window(i);
if n <= numel(range)
A(range(1:n)) = idx(i);
else
A(range) = idx(i);
end
end

How can I remove sp_addextendedproperty from a SQL Server view script?

I am doing a comparison of my Dev and QA databases. My Dev database has a bunch of sp_addextendedproperty information, which prevents the scripts from being an exact match. I tried dropping and recreating the offending view, but the noise is still there. How can I remove sp_addextendedproperty from a SQL Server 2008 R2 view script?
EXECUTE sp_addextendedproperty #name = N'MS_DiagramPane1', #value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "apc"
Begin Extent =
Top = 6
Left = 38
Bottom = 125
Right = 236
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "p"
Begin Extent =
Top = 6
Left = 274
Bottom = 125
Right = 459
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "a"
Begin Extent =
Top = 6
Left = 497
Bottom = 125
Right = 669
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "ch"
Begin Extent =
Top = 6
Left = 707
Bottom = 95
Right = 867
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "c"
Begin Extent =
Top = 6
Left = 905
Bottom = 125
Right = 1065
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "r"
Begin Extent =
Top = 96
Left = 707
Bottom = 185
Right = 867
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500', #level0type = N'SCHEMA', #level0name = N'dbo', #level1type = N'VIEW', #level1name = N'vwAccountProfitCenters';
GO
EXECUTE sp_addextendedproperty #name = N'MS_DiagramPane2', #value = N'
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', #level0type = N'SCHEMA', #level0name = N'dbo', #level1type = N'VIEW', #level1name = N'vwAccountProfitCenters';
GO
EXECUTE sp_addextendedproperty #name = N'MS_DiagramPaneCount', #value = 2, #level0type = N'SCHEMA', #level0name = N'dbo', #level1type = N'VIEW', #level1name = N'vwAccountProfitCenters';
GO
In SQL compare (v10 is the one I have), once you've done your table mappings, there is another tab called options. On here under the ignore section is a tick box for extended properties, tick that and then it won't matter if there are different properties on each table.
As #Tarzan mentions in a comment below:
Yes, from SSMS, go to "Tools > Options > SQL Server Object Explorer > scripting > Script extended properties = False".

Populate a T-SQL Table automatically

I need to input into a table a list of 126 Sites with 7 types of pitches. The script I have written is not right and I cannot figure out why.
What I would like to see is a column of Site_Skey 1, 1, 1, 1, 1, 1, 1 and a column of PitchType_Skey 1,2,3,4,5,6,7 then Site_Skey 2,2,2,2,2,2,2 and a column of PitchType_Skey 1,2,3,4,5,6,7 this need to be repeated 126 times.
Can you help?
Current Script:
DECLARE #PitchType_Skey INT
DECLARE #Site_Skey INT
SET #PitchType_Skey = 1
SET #Site_Skey = 1
WHILE (#PitchType_Skey <= 882)
WHILE (#Site_Skey <= 882)
BEGIN
INSERT INTO Capacity (PitchType_Skey, Site_Skey)
SELECT (CASE WHEN #PitchType_Skey % 7 = 0 THEN 7 ELSE #PitchType_Skey % 7 END),
(CASE WHEN #Site_Skey % 126 = 0 THEN 126 ELSE #Site_Skey % 126 END)
SET #PitchType_Skey = #PitchType_Skey + 1
SET #Site_Skey = #Site_Skey + 1
END
much simpilar way of doing it....
DECLARE #PitchType_Skey INT
DECLARE #Site_Skey INT
SET #PitchType_Skey = 1
SET #Site_Skey = 1
WHILE (#Site_Skey < 127)
BEGIN
IF #PitchType_Skey = 8
BEGIN
SET #PitchType_Skey = 1
SET #Site_Skey = #Site_Skey + 1
END
IF (#Site_Skey < 127)
BEGIN
INSERT INTO dbo.Capacity (PitchType_Skey, Site_Skey)
SELECT #PitchType_Skey, #Site_Skey
END
SET #PitchType_Skey = #PitchType_Skey + 1
END