What is the difference between open sql & native sql ?

Answers were Sorted based on User's Feedback



What is the difference between open sql & native sql ? ..

Answer / manveer kapoor

Open SQL can be compiled and checked and is platform
independent whereas native sql cannot be checked for
compilation errors and is platform dependent.

Is This Answer Correct ?    11 Yes 0 No

What is the difference between open sql & native sql ? ..

Answer / sandeep

open sql
for these sql statements there will be a database interface
where as the native sql statements doesn't have this .the
use of the interface is they can convert the statements in
to the database that they r using
native sql are database specific
open sql statements can b used for transparent pooled and
cluster tables .where asa native sql statements r used for
only transparent tables

Is This Answer Correct ?    9 Yes 1 No

What is the difference between open sql & native sql ? ..

Answer / sameera

Open SQL
Open SQL allows developers to control SQL statements
directly. Open SQL encapsulates the semantics for statement
execution, parameter binding and results fetching provided
by each database vendor in a vendor- independent interface.
The operations performed with Open SQL translate directly
to the primitive operations provided by each database, yet
the API is consistent across all vendors.

To avoid incompatibilities between different database
tables and also to make ABAP/4 programs independent of the
database system in use, SAP has created a set of separate
SQL statements called Open SQL. Open SQL contains a subset
of standard SQL statements as well as some enhancements
which are specific to SAP.

Open SQL contains the following keywords:

SELECT - Reads data from database tables.
INSERT - Adds lines to database tables.
UPDATE - Changes the contents of lines of database tables.
MODIFY - Inserts lines into database tables or changes the
contents of existing lines.
DELETE - Delete lines from database tables.
OPEN CURSOR, FETCH, CLOSE CURSOR - Reads lines of database
tables using the cursor.
All Open SQL statements fill the following two system
fields with return codes:

SY-SUBRC
After every Open SQL statement, the system field SY-SUBRC
contains 0 if the operation was successful, a value other
than 0 if not.
SY-DBCNT
After an OPEN SQL statement, the system field SY-DBCNT
contains the number of database lines processed.
Open SQL allows you to access all database tables known to
the SAP system, regardless of the database manufacturer.
Sometimes, however, we may want to use database-specific
SQL statements called Native SQL in the ABAP/4 program.

A database interface translates SAP\'s Open SQL statements
into SQL commands specific to the database in use. Native
SQL statements access the database directly.

Native SQL
Native SQL allows you to use database-specific SQL
statements in an ABAP program. This means that you can use
database tables that are not administered by the ABAP
Dictionary, and therefore integrate data that is not part
of the R/3 System.

ABAP Native SQL allows you to include database-specific SQL
statements in an ABAP program. Most ABAP programs
containing database-specific SQL statements do not run with
different databases. If different databases are involved,
use Open SQL. To execute ABAP Native SQL in an ABAP
program, use the statement EXEC. Open SQL (Subset of
standard SQL statements), allows you to access all database
tables available in the R/3 System, regardless of the
manufacturer. To avoid conflicts between database tables
and to keep ABAP programs independent from the database
system used, SAP has generated its own set of SQL
statements known as Open SQL.

If you create a table by using database tools, without ABAP
Dictionary, you are not able to use Open SQL to reach this
table. You just can use Native SQL to do that.

Native SQL statements bypass the R/3 database interface.
There is no table logging, and no synchronization with the
database buffer on the application server. For this reason,
you should, wherever possible, use Open SQL to change
database tables declared in the ABAP Dictionary. In
particular, tables declared in the ABAP Dictionary that
contain log columns with types LCHR and LRAW should only be
addressed using Open SQL, since the columns contain extra,
database-specific length information for the column. Native
SQL does not take this information into account, and may
therefore produce incorrect results. Furthermore, Native
SQL does not support automatic client handling. Instead,
you must treat client fields like any other.

To ensure that transactions in the R/3 System are
consistent, you should not use any transaction control
statements (COMMIT, ROLLBACK WORK), or any statements that
set transaction parameters (isolation level…) using Native
SQL.

Using Native SQL, you can

Transfer values from ABAP fields to the database
Read data from the database and process it in ABAP
programs.
Native SQL works without the administrative data about
database tables stored in the ABAP Dictionary.
Consequently, it cannot perform all of the consistency
check used in Open SQL. This places a larger degree
responsibility on application developers to work with ABAP
fields of the correct type. You should always ensure that
the ABAP data type and the type of database column are
identical.

Native SQL Advantages and Disadvantages - EXEC SQL statement
Advantages

Tables are not declared in ABAP Dictionary can be accessed.
(e.g. Tables belonging to sys or system user of Oracle,
etc.)
To use some of the special features supported by the
database-specific SQL. (e.g. Passing hints to Oracle
optimizer.)
Disadvanteges

No syntax check is performed whatever is written between
EXEC and ENDEXEC.
ABAP program containing database-specific SQL statements
will not run under different database systems.
There is no automatic clien handling for client dependent
tables.
Care has to be taken during migration to higher versions.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More SAP ABAP Interview Questions

how can you make select options as a parameter?

5 Answers   De Novo, IBM,


if u have two internal table such as itab1 and itab2.in itab1 has four fields such as f1,f2,f3,f4 and in itab2 has two fields such as f1,f2.then how can u copy data from first internal table to second internal table.

5 Answers   Wipro,


what is call back in alv?

0 Answers  


What are the data types of the external layer? : abap data dictionary

0 Answers  


what is the major advantage of start-form?

2 Answers  






what is the difference between message type and basic type

3 Answers   Cap Gemini,


Difference between stand alone CRM and back-end CRM

0 Answers   Accenture, Steria,


visibility of a field string declared using tables statement? true/false.

1 Answers  


What are the functions of lock objects?

0 Answers  


How to print continuous pages in smartform?my requirement is i need to print 3 pages for each customer i.e 2 pages for purchase order forms and 3rd page is terms and condition page.Likewise how can i print 100 customer pages at once continuously?

2 Answers   Cap Gemini,


Application Category?

0 Answers   Infosys,


What is the significance of at line-selection event?

5 Answers   Infosys,


Categories
  • SAP Basis Interview Questions SAP Basis (1262)
  • SAP ABAP Interview Questions SAP ABAP (3939)
  • SAPScript Interview Questions SAPScript (236)
  • SAP SD (Sales & Distribution) Interview Questions SAP SD (Sales & Distribution) (2716)
  • SAP MM (Material Management) Interview Questions SAP MM (Material Management) (911)
  • SAP QM (Quality Management) Interview Questions SAP QM (Quality Management) (99)
  • SAP PP (Production Planning) Interview Questions SAP PP (Production Planning) (523)
  • SAP PM (Plant Maintenance) Interview Questions SAP PM (Plant Maintenance) (252)
  • SAP PS (Project Systems) Interview Questions SAP PS (Project Systems) (138)
  • SAP FI-CO (Financial Accounting & Controlling) Interview Questions SAP FI-CO (Financial Accounting & Controlling) (2766)
  • SAP HR (Human Resource Management) Interview Questions SAP HR (Human Resource Management) (1180)
  • SAP CRM (Customer Relationship Management) Interview Questions SAP CRM (Customer Relationship Management) (432)
  • SAP SRM (Supplier Relationship Management) Interview Questions SAP SRM (Supplier Relationship Management) (132)
  • SAP APO (Advanced Planner Optimizer) Interview Questions SAP APO (Advanced Planner Optimizer) (92)
  • SAP BW (Business Warehouse) Interview Questions SAP BW (Business Warehouse) (896)
  • SAP Business Workflow Interview Questions SAP Business Workflow (72)
  • SAP Security Interview Questions SAP Security (597)
  • SAP Interfaces Interview Questions SAP Interfaces (74)
  • SAP Netweaver Interview Questions SAP Netweaver (282)
  • SAP ALE IDocs Interview Questions SAP ALE IDocs (163)
  • SAP Business One Interview Questions SAP Business One (110)
  • SAP BO BOBJ (Business Objects) Interview Questions SAP BO BOBJ (Business Objects) (388)
  • SAP CPS (Central Process Scheduling) Interview Questions SAP CPS (Central Process Scheduling) (14)
  • SAP GTS (Global Trade Services) Interview Questions SAP GTS (Global Trade Services) (21)
  • SAP Hybris Interview Questions SAP Hybris (132)
  • SAP HANA Interview Questions SAP HANA (700)
  • SAP PI (Process Integration) Interview Questions SAP PI (Process Integration) (113)
  • SAP PO (Process Orchestration) Interview Questions SAP PO (Process Orchestration) (25)
  • SAP BI (Business Intelligence) Interview Questions SAP BI (Business Intelligence) (174)
  • SAP BPC (Business Planning and Consolidation) Interview Questions SAP BPC (Business Planning and Consolidation) (38)
  • SAP BODS (Business Objects Data Services) Interview Questions SAP BODS (Business Objects Data Services) (49)
  • SAP BODI (Business Objects Data Integrator) Interview Questions SAP BODI (Business Objects Data Integrator) (26)
  • SAP Ariba Interview Questions SAP Ariba (9)
  • SAP Fiori Interview Questions SAP Fiori (45)
  • SAP EWM (Extended Warehouse Management) Interview Questions SAP EWM (Extended Warehouse Management) (58)
  • Sap R/3 Interview Questions Sap R/3 (150)
  • SAP FSCM Financial Supply Chain Management Interview Questions SAP FSCM Financial Supply Chain Management (101)
  • SAP WM (Warehouse Management) Interview Questions SAP WM (Warehouse Management) (31)
  • SAP GRC (Governance Risk and Compliance) Interview Questions SAP GRC (Governance Risk and Compliance) (64)
  • SAP MDM (Master Data Management) Interview Questions SAP MDM (Master Data Management) (0)
  • SAP MRS (Multi Resource Scheduling) Interview Questions SAP MRS (Multi Resource Scheduling) (0)
  • SAP ESS MSS (Employee Manager Self Service) Interview Questions SAP ESS MSS (Employee Manager Self Service) (13)
  • SAP CS (Customer Service) Interview Questions SAP CS (Customer Service) (0)
  • SAP TRM (Treasury and Risk Management) Interview Questions SAP TRM (Treasury and Risk Management) (0)
  • SAP Web Dynpro ABAP Interview Questions SAP Web Dynpro ABAP (198)
  • SAP IBP (Integrated Business Planning) Interview Questions SAP IBP (Integrated Business Planning) (0)
  • SAP OO-ABAP (Object Oriented ABAP) Interview Questions SAP OO-ABAP (Object Oriented ABAP) (70)
  • SAP S/4 HANA Finance (Simple Finance) Interview Questions SAP S/4 HANA Finance (Simple Finance) (143)
  • SAP FS-CD (Collections and Disbursements) Interview Questions SAP FS-CD (Collections and Disbursements) (0)
  • SAP PLM (Product Lifecycle Management) Interview Questions SAP PLM (Product Lifecycle Management) (0)
  • SAP SuccessFactors Interview Questions SAP SuccessFactors (33)
  • SAP Vistex Interview Questions SAP Vistex (0)
  • SAP ISR (IS Retail) Interview Questions SAP ISR (IS Retail) (28)
  • SAP IdM (Identity Management) Interview Questions SAP IdM (Identity Management) (0)
  • SAP IM (Investment Management) Interview Questions SAP IM (Investment Management) (0)
  • SAP UI5 Interview Questions SAP UI5 (59)
  • SAP SCM (Supply Chain Management) Interview Questions SAP SCM (Supply Chain Management) (51)
  • SAP XI (Exchange Infrastructure) Interview Questions SAP XI (Exchange Infrastructure) (49)
  • SAP Cloud Platform Interview Questions SAP Cloud Platform (34)
  • SAP Testing Interview Questions SAP Testing (89)
  • SAP SolMan (Solution Manager) Interview Questions SAP SolMan (Solution Manager) (63)
  • SAP MaxDB Interview Questions SAP MaxDB (116)
  • SAP GUI Interview Questions SAP GUI (15)
  • SAP AllOther Interview Questions SAP AllOther (329)