Thứ Bảy, 28 tháng 1, 2017

Waching daily Jan 29 2017

What's up Internet? I am Manish from RebellionRider.com and today's PL/SQL tutorial is going to

be about how to declare user-define exception using PRAGMA EXCEPTION INIT function in Oracle

Database. In the last PL/SQL tutorial we learnt the

way of declaring user-define exception using RAISE APPLICATION ERROR procedure. Though

this is also a very good way of declaring user define exception but there is a problem

with this method. Here we cannot name the exception.

In PL/SQL we handle all the exceptions which has no name in 'Others' exception handler

and that causes confusion, especially when we are working on a project which is huge

and have multiple user define exceptions. We can easily overcome this problem by using

PRAGMA EXCEPTION INIT function. So what is this PRAGMA EXCEPTION INIT function?

Using the pragma EXCEPTION_INIT we can associate an exception name with an Oracle error number. And

we can use that name in designing the exception handler for the error.

Let's do the example and see how to declare user-define exception using Pragma Exception

Init function in Oracle Database. The demonstrative example is going to remain

the same as the one which we did in the last tutorial except for a few minute changes.

So let's do it. DECLARE

ex_age EXCEPTION; age NUMBER := 17;

This time in the declaration section we have two variables in which first variable is an

Exception variable. This exception variable ex_age will now serve as the user-define exception

and become its name. Second variable is a simple variable with

datatype number. I also initialized this variable with value 17 which is unlike the previous

tutorial where we initialized it by accepting the input value from the user using Accept

command. If you don't know what I am talking about,

then go ahead and watch the previous tutorial. But for now let's move ahead.

After declaring all the variables in the declaration section, we will have the PRAGMA EXCEPTION

INIT statement. PRAGMA EXCEPTION_INIT(ex_age, -20008);

Here we have the exception init statement, before explaining it let me quickly show you

its syntax. PRAGMA EXCEPTION_INIT (exception_name, error_number);

Here we are. You first write the keyword PRAGMA followed

by the function name which is Exception_Init and then inside the parenthesis you pass two

parameters. In which first one is the exception name, which will be the variable name of exception

datatype and second is the error number. You can put any number as error number in

parameter but if you want to use PRAGMA EXCEPTION INIT in conjunction with RAISE APPLICATION

ERROR procedure, then you have to make sure that the number is in between -20,000 to -20,999.

Now let's take a look at our statement. Here as the first parameter I passed the name

of our exception variable and as error number I passed -20008 same as in the last tutorial.

That completes our declaration section. Now let's go ahead and write the execution section.

BEGIN IF age < 18 THEN

RAISE_APPLICATION_ERROR(-20008, 'You should be 18 or above for the DRINK!');

END IF;

DBMS_OUTPUT.PUT_LINE('Sure, What would you like to have?');

EXCEPTION WHEN ex_age THEN DBMS_OUTPUT.PUT_LINE(SQLERRM);

END; /

Here we have the execution section. As you can see it is pretty much same as the one

we coded in the last tutorial. For example in the beginning we raised the exception using

raise application error procedure. As a parameter of this procedure I first passed the number

which is -20,008 This number should match the one you specified

in the pragma exception init function in the declaration section. Though it is not mandatory

but for the sake of consistency and to avoid any confusions, try to match this number with

the one you have passed in your EXCEPTION_INIT function. This way you can easily find that

section of your program which is causing the error in your project.

Second parameter is the error string which will be displayed back to the user along with

the error number. Try to make this error string brief yet descriptive so that the normal user

can understand what the error is all about. And we put this raise statement inside the

'If condition' this way we are making sure that the exception occurs only if the

age of the user is below 18. Right after the raise exception statement

we have a simple DBMS output statement. You can put any number of executable statements

here but for the demonstration I am good with this single statement. This statement will

execute only when the age of the user is 18 or above otherwise the program control will

go to the exception handler. Which is the next part of this execution section.

Have you noticed something different here? No, not yet? Take another look carefully.

Right, exactly… Though the rest is same but unlike the last

tutorial today exception handler has a name of exception, which is ex_age.

So what does that mean? As soon as compiler gets to know that the age of the user is below

18 it raises the exception, when the exception is raised the compiler starts looking for

a matching exception handler. If the exception does not have any name the

compiler looks for the exception handler with the name 'Others' which is the case in

the last tutorial. But if the exception has a name then the compiler looks for the handler

with the matching name. That is exactly the case in today's PL/SQL tutorial.

We raise an exception with the number -20,008 and then map a name ex_age over that number

thereafter using that name we design an exception handler which is printing the error stack

on the display screen. Isn't it simple! Let's compile and see

what happens. As the user age is 17 which is less than 18

thus we got the error. I will be dropping the link of the blog on

the same topic in description of the video. There I've explained the advantage of naming

an exception and answered the question of why we use exception inti function with raise

application error procedure & not with raise statement and what is this PRAGMA keyword

all about. Wait video is not over yet, before winding

up this tutorial I have a task for you. Here I hardwired the value of user age which

is 17. Now you have to write the same example except your example should take the user age

input from the user. The input pop up box must have a customized message not the default

one. Also if you want to introduce some other changes in the example then go ahead & do

that. You have to comment your source code in the

comment section down below. You can also send the screenshot of the pop up input box with

customized message on my twitter @ RebellionRider. So many of you guys have been asking what

equipment and software or devices I use to create these videos. If this video gets 1000

likes then I will make a video explaining my process of making YouTube videos along

with all the devices I use. Thanks for watching this tutorial on how to

declare user define exception using pragma exception init function in oracle database.

Don't forget to Like, Share and Subscribe. Thanks this is Manish from RebellionRider.com

For more infomation >> PL/SQL tutorial 49: Declare user define exception using PRAGMA EXCEPTION_INIT in Oracle Database - Duration: 8:24.

-------------------------------------------

ВСПЫШ И ЧУДО МАШИНКИ Новые серии от Tyomka КРУШИЛА НА ШАРЕ Мультики про машинки для детей 2017 BLAZE - Duration: 3:37.

For more infomation >> ВСПЫШ И ЧУДО МАШИНКИ Новые серии от Tyomka КРУШИЛА НА ШАРЕ Мультики про машинки для детей 2017 BLAZE - Duration: 3:37.

-------------------------------------------

Supergirl 2x10 Sneak Peek #2 "We Can Be Heroes" (HD) Season 2 Episode 10 Sneak Peek #2 - Duration: 0:24.

Give it up Leslie.

We've done this before.

The same thing always happens.

I win, you lose.

I'm not Leslie.

Is that Leslie?

For more infomation >> Supergirl 2x10 Sneak Peek #2 "We Can Be Heroes" (HD) Season 2 Episode 10 Sneak Peek #2 - Duration: 0:24.

-------------------------------------------

Desi Bhabi Romance भाविन सबकुछ दिखादिया - desi romance video - Duration: 0:28.

For more infomation >> Desi Bhabi Romance भाविन सबकुछ दिखादिया - desi romance video - Duration: 0:28.

-------------------------------------------

러시아 여자들이 고른 최고의 남자 패션 / 이상형 월드컵 /한글 자막 - Duration: 8:33.

For more infomation >> 러시아 여자들이 고른 최고의 남자 패션 / 이상형 월드컵 /한글 자막 - Duration: 8:33.

-------------------------------------------

Home Remedies For Reducing Fever | How To Reduce Fever Naturally | Fever Home Remedies - Duration: 2:10.

Home Remedies For Reducing Fever Home Remedies For Reducing Fever

Home Remedies For Reducing Fever Home Remedies For Reducing Fever

Home Remedies For Reducing Fever Home Remedies For Reducing Fever

For more infomation >> Home Remedies For Reducing Fever | How To Reduce Fever Naturally | Fever Home Remedies - Duration: 2:10.

-------------------------------------------

How to Zoom Make Everything Larger for Easy Reading - Duration: 2:28.

hi Guys, welcome.

i hope you are well.

i'am going to teach you something very usefull How to make everything on your

desktop larger, how to zoom when you surf on the internet and how to get ride of eyes

fatigue

most of the time i find it very hard to read because text are too small.and

before i find this technic a very long time ago i always had eyes fatigues while reading

test from the internet

let's start

first thing to do right click anywhere on your

desktop, go into view and select large incons.

now you can clearly see everything on your desktop.

now for internet.

before i learned about this, i had headashe and eyes fatigue almost everyday

just from reading small text.

you just hold control on you keyboard and use your mouse wheel to zoom in or out.you

can zoom as munch as you want and stay zoom on

the website as long as you dont delete your web cache.

you can also zoom inside your document. and i have one

nice trick to get ride of eyes fatigues. have no light in your face while using

your computer.

make sure its behind you. and glasses like Gunnar Optiks might probably help but i have'nt

tested it yet.

and thats it guys, have a nice day

(Song Playing)

For more infomation >> How to Zoom Make Everything Larger for Easy Reading - Duration: 2:28.

-------------------------------------------

Arab Israelis: Can Jews and Arabs live in peace? - Duration: 9:57.

Where do you get your news?

Johaine Bethlehem

Internet

Facebook

Jihan Bethlehem

Facebook?

Which pages?

Maan News (Palestinian)

Maise Bethlehem

TV. Al Jazeera, Al Arabiya

Facebook, many pages

Local

Local pages

Iyad Jericho

TV

Which?

Usually television and we see the news

Al Jazeera and Palestinian tv

Palestine tv is the Fatah station?

Its from the Palestinian Authority

Where do you get your news or media?

Khalid and others Tarshiha (Israel) filmed in Bethlehem

Local pages

Local web sites from Google

and YouTube

Which specific pages on Facebook or YouTube?

Us Palestinians from 1948 (Israeli Arabs)

we take our news from

Akbaria Syria the Syrian news channel

Palestinian local channels

and also Israeli channels

But usually and mostly

we watch a channel called Al Mayyadeen

Which is from where?

It's a Lebanese channel

They sit in Lebanon

but they talk about all the Arab countries

All what's happening in all the Arab countries

Still today? - Yes

It's very nice

It's 24 hours

It's good information? -Yes

Where do you get your information

about the situation?

Melaz (20 something man) Nablus

Face - Facebook

Facebook, yes - We only have Facebook

You don't watch Al Jazeera?

The newspapers?

No, no

Only online

What about other web sites for news?

No, not at all

Where do you get your information? Internet?

Which sites?

Facebook

20 something guys in Bir Zeit

El Awal Ikhbaria

Name of a page on Facebook

"The Pioneers" or "The Firsts"

Al Mukaber net

Also the name of a page

And you?

What?

Where do you get your news?

On the internet

From the TV

Which tv station?

Al Jazeera and Palestine TV

Where do you get your news from?

Ensam Doha

There is more than one channel or one outlet, for example

Kobet Rahel on Facebook

Al Jazeera on television

and another channel called Palestine Today

and Maan Mix

Which one does she watch the most or check the most

Kobet Rahel on Facebook

What does that mean?

What does that mean exactly?

It's an area in Bethlehem

where there are a lot of clashes

between the Israelis and the Palestinians

So it's named after that? - Yes

It's named after that area

Where do you get your news?

Ahmad Bethlehem

What news?

Someone was killed today

So we watch television

Which channel is that?

We have Al Jazeera

Which ones do you prefer?

He is joking and saying "Al Aqsa" which belongs to Hamas

It's a joke because he was in the Fatah (party)

We have National Geographic

News?

I don't really follow the news

Where do you get your information?

Bashir Kfar Qasam (Israeli village)

- Internet (his brother)

Books, newspapers and magazines

Which newspapers?

Since he is not from the West Bank he is from Israel (filmed in Jericho)

He reads the Israeli newspapers

In Hebrew?

Israel Hayom, Yediot Ahronot

Maariv

Where do you get your information on the situation?

Ahmad Nablus

The situation in Palestine?

Palestine, Israel

Social media

Which apps?

Facebook, Twitter

So you don't watch Al Jazeera?

Al Jazeera? No

You don't read Palestinian newspapers?

Sometimes

Which one?

Al Quds

Where does he get his information?

Abdula Aqabat Jaber refugee camp

From the internet

Which sites?

Google, Facebook

Anything

Is there any specfic news organization?

Yes, Maan News

Không có nhận xét nào:

Đăng nhận xét