Subscribe to this blog

NEWSLETTER

Search This Blog

Featured post

DevOps means a concept to bring Development team and operation team together. So that you can speed up the deployment process. Before you start learning the tools you need to understand core principles. The useful DevOps Principles to know for your project and interviewsTo deliver rapidly without affecting qualityCommunication and Collaboration are the key ideas in DevOps conceptMultiple deploys are possible- if code in Development team automatedOnce you commit the repository, it tests the code automatically against the automated test scriptsIf Build is successfully passed, it installs automatically in Testing environment When infrastructure is automated, it installs automatically to other serversMinor changes takes place in isolation, that means , it creates separate server to deploy minor changesSpeed in Devops, organizations to better serve their customers and compete more effectively in the market.Quality and Security teams are part of DevOpsAutomating the process, much better pro…

Learn How To Avoid Exceptions in PL SQL Procedure

PL/SQL is procedural language, and the PL/SQL procedures you can call from any high-level language. This is depending on your project requirement.

PL SQL

How to prevent some common errors or exceptions while writing PL/SQL procedures in your project.

The number one and primary one is assigning variables non-numeric to numeric. This is one kind of area where you need to look in while writing PL/SQL procedure.

PL/SQL is nothing but an invitation for trouble. They are all centered on data types and implicit conversion.

What's implicit conversion?

Let's say you have number held in a varchar2 data type variable, v_value. You try assigning n_value, a number data type variable, that value with the following line of code:n_value := v_value;

That should work, right?

Yes, it should, but when it doesn't, because you don't actually have a numeric literal stored in variable v_value, the implicit data type conversion will raise an "unexpected" exception in your program unit.
Another most common issue is assigning DATE field to numeric field while writing PL/SQL procedure. Usually, it will not work, and it will through a conversion error.

You want to pass a date value to a function that will return the time in seconds since midnight, January 1, 1980. The function requires the date be passed as a varchar2 parameter in the form DD-MON-YY.

```sql
d_value date := sysdate;
n_value number;
```

```sql
BEGIN
n_value := date_to_long(d_value);
```

Sample PL/SQL

Oracle's default date format is DD-MON-YY, so it will work fine, right?

Not exactly. If the current NLS_DATE_FORMAT for the session is DD-MON-YY (the default), it will work, but not if it is YYYYMMDD HH24MISS, as I set mine every time I log in to SQL*Plus.

The above two kinds of errors you can avoid as a preventive measure while writing your PL/SQL procedure.

Comments

Post a Comment

Most Viewed

I am practicing Hyperledger. This is one of the top listed blockchains. This architecture follows R3 Corda specifications. Sharing the interview questions with you that I have prepared for my interview.

Though Ethereum leads in the real-time applications. The latest Hyperledger version is now ready for production applications. It has now become stable for production applications.The Hyperledger now backed by IBM. But, it is still an open source. These interview questions help you to read quickly.
The below set of interview questions help you like a tutorial on Hyperledger fabric.
Hyperledger Fabric Interview Questions1). What are Nodes?
In Hyperledger the communication entities are called Nodes.

2). What are the three different types of Nodes?
- Client Node
- Peer Node
- Order Node
The Client node initiates transactions. The peer node commits the transaction. The order node guarantees the delivery.

3). What is Channel?
A channel in Hyperledger is the subnet of the main blockchain. You c…