Powerbuilder Interview Questions Part 2




How can you update datawindow created from procedure? 


You need to do so from some other procedure Or through the explicit embaded update statement.




Can you modify the sql of datawindow runtime and how?


Yes we can modify the sql of the datawindow.

Specifies the SQL SELECT statement for a DataWindow control or DataStore.



DataWindow controls, DataStore objects, and child DataWindows



dwcontrol.SetSQLSelect ( statement )


Argument Description



Dwcontrol        The name of the DataWindow control, DataStore, or child DataWindow for which you want to change the SELECT statement


Statement         A string whose value is the SELECT statement for the DataWindow object. The statement must structurally match the current SELECT statement (that is, it must return the same number of columns, the columns must be the same data type, and the columns must be in the same order)


Return value

Integer. SetSQLSelect returns 1 if it succeeds and -1 if the SELECT statement cannot be changed. If any argument’s value is NULL, SetSQLSelect returns NULL.



Use SetSQLSelect to dynamically change the SQL SELECT statement for a DataWindow object in a script.

If the DataWindow is updatable, PowerBuilder validates the SELECT statement against the database and DataWindow column specifications when you call the SetSQLSelect function. Each column in the SQL SELECT statement must match the column type in the DataWindow object. The statement is validated only if the DataWindow object is updatable.


You must use the SetTrans or SetTransObject function to set the transaction object before the SetSQLSelect function will execute.


If the new SELECT statement has a different table name in the FROM clause and the DataWindow object is updatable, then PowerBuilder must change the update information for the DataWindow object. PowerBuilder assumes the key columns are in the same positions as in the original definition. The following conditions will make the DataWindow not updatable:


¨           There is more than one table in the FROM clause.

¨           A DataWindow update column is a computed column in the SELECT statement.


If changing the SELECT statement makes the DataWindow object not updatable, the DataWindow control cannot execute an Update function call for the DataWindow object in the future.


Limitations to using SetSQLSelect  Use SetSQLSelect only if the data source for the DataWindow object is a SQL SELECT statement without retrieval arguments and you want PowerBuilder to modify the update information for the DataWindow object:




Modify will not verify the SELECT statement or change the update information, making it faster but more susceptible to user error. Although you can use Modify when arguments are involved, it is not recommended because of the lack of checking.





How can you get sql statement of the datawindow objects?


Reports the SQL SELECT statement associated with a DataWindow if its data source is one that accesses an SQL database (such as SQL Select, Quick Select, or Query).



DataWindow controls, DataStore objects, and child DataWindows



dwcontrol.GetSQLSelect ( )



Argument Description


dwcontrol         The name of the DataWindow control, DataStore, or child DataWindow for which you want to obtain the current SELECT statement


Return value

String. Returns the current SQL SELECT statement for dwcontrol. GetSQLSelect returns the empty string (“”) if it cannot return the statement. If  dwcontrol is NULL, GetSQLSelect returns NULL.





When you want to change the SQL SELECT statement for a DataWindow or DataStore during execution, you can use GetSQLSelect to save the current SELECT statement before making the change.


When you define a DataWindow, PowerBuilder stores a PowerBuilder SELECT statement (PBSELECT) with the DataWindow. If a database is connected and SetTransObject has been called for the DataWindow, then GetSQLSelect returns the SQL SELECT statement. Otherwise, GetSQLSelect returns the PBSELECT statement.


You can also use Describe to obtain the SQL SELECT statement. The DataWindow object’s Table.Select property holds the information.





How can you update multiple tables in a datawindow?



We can update multiple table by updating one table by calling update function and then calling describe and modify function to set database table and updateable column and reset the modify flag to update next table.





How can you set attribute of datawindow?


We can set the attribute of datawindow using modify function as well as using datawindow.object.column.attribute = some valid value. And dot notation.






How can you get the attribute of the datawindow?


We can get the attribute of the datawindow by using describe function.





If you pass only empty string with modify function what will happen?


Modifies a DataWindow object by applying specifications, specified as a list of instructions that change the DataWindow object’s definition. You can change appearance, behavior, and database information for the DataWindow object by changing the values of properties. You can add and remove objects from the DataWindow object by providing specifications for the objects.


For lists and explanations of DataWindow object properties, see the DataWindow Reference.



DataWindow controls, DataStore objects, and child DataWindows



dwcontrol.Modify ( modstring )


Argument Description



dwcontrol         The name of the DataWindow control, DataStore, or child DataWindow you are modifying


modstring        A string whose value is the specifications for the modification. See Usage for appropriate formats


Return value


String. Returns the empty string (“”) if it succeeds and an error message if an error occurs. The error message takes the form “Line n Column n incorrect syntax”. The columns are counted from the beginning of the compiled text of modstring. If any argument’s value is NULL, Modify returns NULL.



Modify lets you make many of the same settings in a script that you would make in the DataWindow painter. Typical uses for Modify are:


¨           Changing colors, text settings, and other appearance settings of objects

¨           Changing the update status of different tables in the DataWindow so that you can update more than one table

¨           Modifying the WHERE clause of the DataWindow object’s SQL SELECT statement

¨           Turning on Query mode or Prompt For Criteria so users can specify the data they want

¨           Changing the status of Retrieve Only As Needed

¨           Changing the data source of the DataWindow object


¨           Controlling the Print Preview display

¨           Deleting and adding objects (such as lines or bitmaps) in the DataWindow object


Each of these uses is illustrated in the Examples for this function.


You can use three types of statements in modstring to modify a DataWindow object.


CREATE object (settings)         Adds object to the DataWindow object (such as text, computed fields, and bitmaps). A setting is a list of properties and values using the format you see in exported DataWindow syntax. To create an object, you must supply enough information to define it.Object cannot be an OLE object. You cannot add an OLE object to a DataWindow using the Modify function


DESTROY [COLUMN] object     Removes object from the DataWindow object. When object is a column name, specify the keyword COLUMN to remove both the column and the column’s data from the buffer

objectname.property=value        Changes the value of property to value. Properties control the location, color, size, font, and other settings for objectname. When objectname is DataWindow, you can also set properties for database access. The DataWindow Reference has lists of objects in a DataWindow, their properties, and values.Depending on the specific property, value can be:

 ¨ A constant  A quoted constant ¨          An expression that consists of a default value followed by a valid DataWindow expression that returns the appropriate data type for the property.

Expressions are described below Object names 


The DataWindow painter automatically gives names to columns and column labels. Other objects that you add to the DataWindow object are named with a cryptic string of numbers unless you give them names. (Describe will report the cryptic names, but you can’t see them in the painter.) To easily describe and modify properties of an object, give the object a name.


Expressions for Modify 


When you specify an expression for a DataWindow property, the expression has the format:




Defaultvalue is a value that can be converted to the appropriate data type for the property. It is followed by a tab (~t). DataWindowpainterexpression is an expression that can use any DataWindow painter function. The expression must also evaluate to the appropriate data type for the property. When you are setting a column’s property, the expression is evaluated for each row in the DataWindow, which allows you to vary the display based on the data. A typical expression uses the If function:


‘16777215 ~t If(emp_status=~~’A~~’,255,16777215)’


To use that expression in a modstring, specify the following (entered as a single line):


modstring = “emp_id.Color=’16777215 ~t




Not all properties accept expressions. For details on each property, see the DataWindow Reference.


Quotes and tildes 


Because Modify’s argument is a string, which can include other strings, you need to use special syntax to specify quotation marks. To specify that a quotation mark be used within the string rather than match and end a previously opened quote, you can either specify the other style of quote (single quotes nested with double quotes) or precede the quotation mark with a tilde (~). For another level of nesting, the string itself must specify ~”, so you must specify ~~ (which specifies a tilde) followed by ~” (which specifies a quote). For example, another way to type the modstring shown above is (entered as a single line):


modstring = “emp_id.Color=~”16777215 ~t




For more information about quotes and tildes, see “Standard data types”.


Building a modstring with variables 


To use variable data in modstring, you can build the string using variables in your program. As you concatenate sections of modstring, make sure quotes are included in the string where necessary. For example, the following code builds a modstring similar to the one above, but the default color value and the two color values in the If function are calculated in the script. Notice how the single quotes around the expression are included in the first and last pieces of the string:


red_amount = Integer(sle_1.Text)


modstring = “emp_id.Color='” + &


String(RGB(red_amount, 255, 255)) + &


“~tIf(emp_status=~~’A~~’,” + &


String(RGB(255, 0, 0)) + &


“,” + &


String(RGB(red_amount, 255, 255)) + &




The following is a simpler example without the If function. You don’t need quotes around the value if you are not specifying an expression. Here the String and RGB functions result in a constant value in the resulting modstring:


modstring = “emp_id.Color=” + &


String(RGB(red_amount, 255, 255))


You can set several properties with a single call to Modify by including each property setting in modstring separated by spaces. For example, assume the following is entered on a single line in the script editor:


rtn = dw_1.Modify(“emp_id.Font.Italic=0






However, it is easier to understand and debug a script in which each call to Modify sets one property.


Debugging tip  If you build your modstring and store it in a variable that is the argument for Modify, you can look at the value of the variable in Debug mode. When Modify’s error message reports a column number, you can count the characters as you look at the compiled modstring.


Modifying a WHERE clause  For efficiency, use Modify instead of SetSQLSelect to modify a WHERE clause. Modify is faster because it does not verify the syntax and does not change the update status of the DataWindow object. However, Modify is more susceptible to user error. SetSQLSelect modifies the syntax twice (when the syntax is modified and when the retrieve executes) and affects the update status of the DataWindow object.


PowerBuilder already includes many functions for modifying a DataWindow. Before using Modify, check the list of DataWindow functions in Objects and Controls to see if a function exists for making the change. Many of these functions are listed below in See also.


Modify is for modifying the properties of a DataWindow object. You can set properties of the DataWindow control that contains the object using standard dot notation. For example, to put a border on the control, specify:






How can we set itemstatus  of the datawindows.


Changes the modification status of a row or a column within a row. The modification status determines the type of SQL statement the Update function will generate for the row.



DataWindow controls, DataStore objects, and child DataWindows



dwcontrol.SetItemStatus ( row, column, dwbuffer, status )


Argument Description


dwcontrol         The name of the DataWindow control, DataStore, or child DataWindow in which you want to set the status of an item at a specified row and column


row      A long identifying the row location in which you want to set the status


column  The column location in which you want to set the status.  Column can be a column number (integer) or a column name (string). To set the status for the row, enter 0 for column


dwbuffer  A dwBuffer enumerated data type identifying the DataWindow buffer that contains the row:             ¨PRIMARY! — The data in the primary buffer (the data that has not been deleted or filtered out)

¨DELETE! — The data in the delete buffer (data deleted from the DataWindow object)

¨FILTER! — The data in the filter buffer (data that was filtered out)


status   A dwItemStatus enumerated data type representing the new status:

¨NotModified!¨   DataModified!¨  New!¨    NewModified!For definitions of the values of dwItemStatus, see GetItemStatus


Return value

Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, SetItemStatus returns NULL.



How statuses are set 

There are four DataWindow item statuses, two of which apply only to rows:

Status   Applies to


New!     Rows

NewModified!    Rows

NotModified!     Rows and columns

DataModified!   Rows and columns


When data is retrieved  When data is retrieved into a DataWindow, all rows and columns initially have a status of NotModified!.


After data has changed in a column in a particular row, either because the user changed the data or the data was changed programmatically, such as through the SetItem function, the column status for that column changes to DataModified!.

Once the status for any column in a retrieved row changes to DataModified!, the row status also changes to DataModified!.


When rows are inserted  When a row is inserted into a DataWindow, it initially has a row status of New!, and all columns in that row initially have a column status of NotModified!. After data has changed in a column in the row, either because the user changed the data or the data was changed programmatically, such as through the SetItem function, the column status changes to DataModified!. Once the status for any column in the inserted row changes to DataModified!, the row status changes to NewModified!.


When a DataWindow column has a default value, the column’s status does not change to DataModified! until the user makes at least one actual change to a column in that row.

When Update is called 

A row’s status flag determines what SQL command the Update function uses to update the database. INSERT or UPDATE is called depending upon the following row statuses:

Row status        SQL statement generated

NewModified!    INSERT

DataModified!   UPDATE


A column is included in an UPDATE statement only if the following two conditions are met:

¨           The column is on the updateable column list maintained by the DataWindow object


For more information about setting the update characteristics of the DataWindow object, see the PowerBuilder User’s Guide.

¨           The column has a column status of DataModified!


The DataWindow control includes all columns in INSERT statements it generates. If a column has no value, the DataWindow attempts to insert a NULL. This causes a database error if the database does not allow Null’s in that column.


Changing statuses using SetItemStatus 


Use SetItemStatus when you want to change the way a row will be updated. Typically, you do this to prevent the default behavior from taking place. For example, you might copy a row from one DataWindow to another. After the user modifies the row, you want to issue an UPDATE statement instead of an INSERT statement.


Changing column status You use SetItemStatus to change the column status from DataModified! To NotModified! Or vice versa.

Change column status when you change row status Changing the row status will change the status of all columns in that row to NotModified!, so if the Update function is called, no SQL update is produced. You must change the status of columns to be updated after you change the row status.


Changing row status Changing row status is a little more complicated. The following table illustrates the effect of changing from one row status to another:


Original status Specified status


New!               NewModified!      DataModified!   NotModified!

New!     –           Yes                         Yes                             No

NewModified!    No        –                  Yes                New!

DataModified!   NewModified!           Yes                Yes

NotModified!     Yes                          Yes               Yes –


In the preceding table,

Yes means the change is valid. For example, issuing SetItemStatus on a row that has the status NotModified! to change the status to New! does change the status to New!.

No means that the change is not valid and the status is not changed.


Issuing SetItemStatus to change a row status from NewModified! to NotModified! actually changes the status to New!. Issuing SetItemStatus to change a row status from DataModified! to New! actually changes the status to NewModified!.


Changing a row’s status to NotModified! or New! causes all columns in that row to be assigned a column status of NotModified!. Change the column’s status to DataModified! to ensure that an update results in a SQL UPDATE.

Changing the status of a retrieved row from NotModified! to New!  If you change the status of a retrieved row to New! and then make a change to data in a column, all the columns in that row will change status to DataModified! All the columns change status because the Update function generates a SQL INSERT command that includes the changed data as well as the data that already existed in the other columns.


Changing status indirectly 

When you cannot change to the desired status directly, you can usually do it indirectly. For example, change New! to DataModified! To NotModified!.

Resetting status for the whole DataWindow object 

To reset the update status of the entire DataWindow object, use the ResetUpdate function. This sets all status flags to NotModified! Except for New! Status flags, which remain, unchanged.





What all are the datawinsdow styles and datasources in pb?


Data window styles – grid, group, n-app, label, tabular, cross tab, composite, graph, ole, ritchtext, free form.

Datasource – Query, Quick Select, Stored Procedures, External, SQL Select




How pb implements oops concept?


Basically OOP s include inheritance, Polymorphism and encapsulation. And pb implement these all through the objects like window, user objects.




What is overwriting the functions?


Suppose you have a object having one function and you have inherited another object from the existing one and define the same function with same signature the function will get overwrite this is call the function overwriting.




What is the linkage service in PFC.


The PFC linkage service helps you to create master/detail windows and other types of windows that require coordinated processing.

The linkage service contains the following features:

|Linkage style  Controls whether detail DataWindows retrieve rows, filter rows, or scroll to the appropriate row

|Update style  Controls how the linkage service updates DataWindows (top-down, bottom-up, top-down then bottom-up, bottom-up then top-down, or a developer-specified custom update)

|Confirm on row change  When the master changes rows, this option displays a confirmation dialog if modifications made to detail DataWindows will be lost

|Confirm on delete  Displays a confirmation dialog when the user deletes rows

|Cascading key changes  The linkage service automatically updates detail DataWindows when you change a key value on the master

|Delete style  When you delete a master row, this option specifies whether the linkage service deletes detail rows, discards detail rows, or leaves them alone

|Extended update  Allows you to integrate other controls (such as ListViews, TreeViews, and DataStores) into the default save process

The linkage service is completed integrated with n_cst_luw and with the w_master pfc_Save process.

PFC enables the linkage service through the n_cst_dwsrv_linkage user object.


You can use the linkage service to coordinate any type of processing among DataWindows. However, the most common use is for master/detail processing.

to enable the linkage service:


Call the u_dw of_SetLinkage function:


U_dw destroys the service automatically when the DataWindow is destroyed.


To use the linkage service to coordinate Master/Detail processing:


1 Enable the linkage service for both the master and detail DataWindows by calling the u_dw of_SetLinkage function, once for each DataWindow:




2 Call the u_dw of_SetTransObject function to establish the Transaction object for the master and detail DataWindows:



3 Link the detail to the master by calling the of_SetMaster function in the detail DataWindow:



4 Register the related columns by calling the of_Register function:

   dw_detail.inv_linkage.of_Register &  (“emp_id”,”emp_id”)


5 (Optional) Specify that the service updates DataWindows from the bottom of the linkage chain on up (the   default is to update top down):

dw_detail.inv_linkage.of_SetUpdateStyle  &  (dw_detail.inv_linkage.BOTTOMUP)


6 Establish the action taken by the detail when a row changes in the master by calling the of_SetStyle function.

This example specifies that the detail DataWindow retrieves a row whenever the master changes:

dw_detail.inv_linkage.of_SetStyle  &  (dw_detail.inv_linkage.RETRIEVE)


7 Call the master DataWindow’s of_Retrieve function:

IF dw_master.of_Retrieve( ) = -1 THEN

 MessageBox(“Error”,”Retrieve error”)


 Dw_master.SetFocus( )


Previous steps can be in one script

You can code the previous steps in a single event, such as the window Open event.


8 Add retrieval logic to the master DataWindow’s pfc_Retrieve event:

Return this.Retrieve( )

Retrieving rows

If the linkage service refreshes detail rows via retrieval, you only need to code a Retrieve function for the master DataWindow. With the filter and scroll options, you must also code Retrieve functions in detail DataWindows.


To enable confirm on row change (retrieval style only):


1 Call the of_SetUpdateOnRowChange function for the detail DataWindow:



2 Call the of_SetConfirmOnRowChange function for the detail DataWindow:

dw_detail.inv_linkage.of_SetConfirmOnRowChange  &



To enable confirm on delete:

1 Call the of_SetUpdateOnRowChange function for the detail DataWindow:



2 Call the of_SetConfirmOnDelete function for the detail DataWindow:



To enable cascading key changes:

Call the of_SetSyncOnKeyChange function for every DataWindow in the linkage chain:



vTo specify deletion style:

|Call the of_SetDeleteStyle function for all master DataWindows in the linkage chain:

dw_master.inv_linkage.of_SetDeleteStyle  &



To enable extended update:

Call the of_SetOtherSaveObjects function to add other controls to the default save process:

PowerObject  lpo_objs[ ]


// This example adds the lv_salesinfo ListView

// to the save process.

lpo_objs[1] = lv_salesinfo

dw_master.inv_linkage.of_SetOtherSaveObjects  &






What is the datawindow cashing service in pfc and what is the use of it?


The DataWindow caching service buffers data for DataWindow objects. By keeping rows in memory, the DataWindow caching service helps to reduce database access, optimizing application performance. The DataWindow caching service supports the following data sources:

lDataWindow object (using either data retrieved from the database or data stored with the DataWindow object)

lSQL statement

lDataWindow control

lDataStore control

lRows from an array

lA file

The DataWindow caching service uses PowerBuilder DataStores to buffer data.

PFC enables DataWindow caching through the n_cst_dwcache user object.

PFC code is in ancestor-level objects

This book always refers to extension-level objects (such as n_cst_dwcache). All PFC code is actually in ancestor-level objects (such as pfc_n_cst_dwcache).



Use DataWindow caching to minimize database access and optimize performance.


To enable DataWindow caching:

Call the n_cst_appmanager of_SetDWCache function:



To use DataWindow caching:

Cache data by calling the of_Register function, passing different arguments depending on the data to be cached:

lTo cache rows retrieved from the database via a DataWindow object, pass an identifier, a Transaction object, the DataWindow object name, and arguments if any

lTo cache rows retrieved from the database via a SQL statement, pass an identifier, a Transaction object, and the SQL statement

lTo cache rows in an array, pass an identifier, the DataWindow object name, and the data

lTo cache rows from a DataWindow control, pass an identifier and the DataWindow control

lTo cache rows from a DataStore, pass an identifier and the DataStore instance

lTo cache rows from a file, pass an identifier and the filename


2 To determine if a DataWindow object is already registered with the caching service, call the of_IsRegistered function, passing the object’s identifier.


3 To access cached data from, call the of_GetRegistered function. This example assumes an ids_datastore instance variable:

gnv_app.inv_dwcache.of_GetRegistered  &  (“d_emplist”, ids_datastore)



4 To reretrieve data for a cached DataWindow, call the of_Refresh function.


5 To stop caching call the of_UnRegister function.


6 (Optional) Disable the DataWindow caching service by calling the n_cst_appmanager of_SetDWCache function:



In most cases, you do not disable DataWindow caching explicitly. PFC destroys n_cst_dwcache automatically when your application shuts down.





What is the difference in parameter to functions by value and by reference?


By value means it creates its own copy to work and if we make the changes in any thing it will affect in copy not in actual objects. But parameter by reference means variable keeps the reference of the object and there will not be any copy whatever changes we will do will takes place in the actual objects value.





What is the cursor and what are the types of cursor?



Cursor is the pointer, which point to a record and allow us to do row by row manipulations.


A cursor is a symbolic name that is associated with a Transact-SQL select statement through a declaration statement. It consists of the following parts:


cursor result set  – the set (table) of rows resulting from the execution of a query associated with the cursor


cursor position  – a pointer to one row within the cursor result set


The cursor position indicates the current row of the cursor. You can explicitly modify or delete that row using delete or update statements with a clause naming the cursor. You change the current cursor position through an operation called a fetch. A fetch moves the current cursor position one or more rows down the cursor result set.


A cursor behaves much like a file pointer to a series of file records, where the cursor acts as a pointer to the query results. However, cursors only support forward (or sequential) movement through the query results. Once you fetch several rows, you cannot backtrack through the cursor result set to access them again. This process allows you to traverse the query results row by row, similar to how a programming language can access one file record at a time.


After you declare the cursor, it is in one of two states:


Closed – The cursor result set does not exist, so you cannot read information from it. Cursors are initially in this state. You must explicitly open the cursor before you can use it. Once it is opened, you can explicitly close it when you are finished. SQL Server can implicitly close a cursor for several reasons described later in this chapter.


Open – The rows within the cursor result set are available for reading or updating.


You can close a cursor and then reopen it. Reopening a cursor recreates the cursor result set and positions the cursor right before the first row. This allows you to process through a cursor result set as many times as needed. You can close the cursor at any time; you do not have go through the entire result set.


All cursor operations, like fetching or updating the row, are accomplished in reference to the current cursor position. Updating cursor rows involves changing data in the row or deleting the row completely. You cannot use cursors to insert rows. All updates through a cursor affects the corresponding base tables included in the cursor result set.





What are different joins?


Joining two or more tables is a process of comparing the data in specified fields and using the comparison results to form a new table from the rows that qualify. A join statement specifies a column from each table, compares the values in those columns row by row, and combines rows with qualifying values into new rows. The comparison is usually for equality-values that match exactly-but other types of joins can be specified. If a join is to have meaningful results, the columns being compared must have similar values-values that are comparable because they have the same or similar datatypes.


The join operation has a jargon all its own. The word “join” is used both as a verb, and as a noun, referring to the operation itself, to the query, or to its results.


There are several varieties of joins-equijoin, natural join, outer join, and so





What are the stored procedure what is the use of it?


Stored procedures are collections of SQL statements and control-of-flow language. An execution plan is prepared when a procedure is run, so that subsequent execution is very fast. Stored procedures can:


Take parameters


Call other procedures


Return a status value to a calling procedure or batch to indicate success or failure, and the reason for failure


Return values of parameters to a calling procedure or batch


Be executed on remote SQL Servers


The ability to write stored procedures greatly enhances the power, efficiency, and flexibility of SQL. Compiled procedures dramatically improve the performance of SQL statements and batches. In addition, stored procedures on other SQL Servers can be executed if your server and the remote server are both set up to allow remote logins. You can write triggers on your local SQL Server that execute procedures on a remote server whenever certain events, such as deletions, updates or inserts, take place locally. 


Stored procedures differ from ordinary SQL statements and from batches of SQL statements in that they are pre-compiled. The first time you run a procedure, SQL Server’s query processor analyzes it and prepares an execution plan that is ultimately stored in a system table . Subsequently, the procedure is executed according to the stored plan. Since most of the query processing work has already been performed, stored procedures execute almost instantaneously.


SQL Server supplies a variety of stored procedures as convenient tools for the user. These stored procedures are called system procedures. 


You create stored procedures with the  create procedure  command. To execute a stored procedure, either a system procedure or a user-defined procedure, use the  execute command. Or you can use the name of the stored procedure alone, as long as it is the first word of a statement or batch.


The syntax for creating a simple stored procedure, without special features such as parameters, is:


create procedure procedure_name


as SQL_statements


Stored procedures are database objects, and their names must follow the rules for identifiers.


Any number and kind of SQL statements can be included with the exception of create statements.





What are the structures?


A structure is a collection of one or more related variables of the same or different data types grouped under a single name. In some languages, such as Pascal and COBOL, structures are called records. Structures allow you to refer to related entities as a unit rather than individually. For example, if you define the user’s ID, address, access level, and a picture (bitmap) of the employee as a structure called user_struct, you can then refer to this collection of variables as user_struct.


There are two kinds of structures:

·Object-level structures, which are associated with a particular type of object such as a window or menu. These structures can always be used in scripts for the object itself. You can also choose to make the structures accessible from other scripts.


Global structures, which are not associated with any object in your application. You can directly reference these structures anywhere in your application.





What is mean by table mutation?






What is the difference between delete and truncate statement?


Delete statement can be used to delete specifice no. of records where as truncate will delete all the records at a time. Delete statement make entry in to database log so that it is slower than truncate also you can not get back the records which are truncated but we can in case of delete.





Can you create multiple transaction objects in pb?


Yes you can create multiple transaction objects using create statement.





What is two tier and three-tier architecture?


Two tire architecture means there will be only front end and back end and we write our business process in back end or front end. In case of three tires architecture there is one more layer in between in which we write our business processes. Two tires are faster and economical as compare to three tires. If in future some conversion take place or some changes has been taken place in the business process in case of three tire architecture things goes smoothly while in two tire architecture creates complications.




What is thin layer and thick layer database?







What is parsing in oracles?






What are the databases provided with sybase?


There are four-system databases and one sample database when you install the Sybase on your machine they are Master, Model, sybsystemproc, temporary database and the pub2 is the sample database.





What sql Sybase uses?


Sybase uses T SQL means transact sql which is the extension to SQL.





What sql oracle uses?


Oracle uses SQL Plus, which is the extension to SQL.



What is the minus of two tables?




How can you get the procedure definitions in oracle?



Write query to find second highest salary?



Write query to get department having max emp.?



What is full and incremental exe.




Ans :

What is machine code exe?


Machine code is nothing but DLL




Ans :

How can you create pbd and dll with exe?


If you select machine code option  and select the pbd option for pbls while creating the exe will generate dlls and without selecting machincode you can generates pbd.






Can you create single pbd or dll .how?


Yes, by selecting only that pbl.




What is the difference bitween pbd and dll?


DLL : 1. It takes much time to create the EXE

           2. Faster than the PBD.

PBD   1. It not takes much time to create the EXE

           2. Slower than the DLL





What is PBR and what is the use of it? And how will you create it?



PowerBuilder Resource (PBR) file that includes resources that are assigned dynamically in scripts for the application. The name of each object must exactly match the name used to reference the object in scripts (if the name is fully qualified in the script it must be fully qualified in the PBR file).




Can you create exe with out pbd and dll?






What are check in and check out and what is use of it?


Check in – now any user having access to it can use that object.

Check out – now some body is using that object and no body can use that object.

This provides security and control over maintaining versions.




Can you update procedure definition through pb?






Can you set querymode to datawindow, which you are using in share data? What will happen?



No. if you do so it will raise runtime error.




Can you pass parameter to procedure dynamically?



Yes. While executing the procedure dynamically.




What will happen if we write script in other event?



Occurs when a system message occurs that is not a PowerBuilder message. You should avoid using it (it slows performance while it checks every Windows message).





Difference between Pb And VB?


Pb follows OOPS concept while VB does not. There is a facility called datawindow through which we can present data from database directly which is not in VB.





What are the datawindow objects sources types?


1.       Quick Select 2. Sql Select 3. Query 4. External 5. Store Procedure.





What for the external datawindow objects are used?



When we have to write the complicated query or joins then we used external datawindow. And basically we use external datawindow for report purpose. If we are not using any DBMS or RDBMS..





What is the difference between quick select and sql select?



In the Quick Select dialog box, you can choose columns from one table or from multiple tables if they are joined through foreign keys. You can not sort and group the columns and specify retrieval criteria and you can not add computed column. Which all are possible in sql select.





What is function openwithparm and what are the parameters to it?


Opens a window object of a known data type. OpenWithParm displays the window and makes all its properties and controls available to scripts. It also stores a parameter in the system’s Message object.


OpenWithParm ( windowvar, parameter {, parent } )


Windowvar       The name of the window you want to display. You can specify a window object defined in the Window painter (which is a window data type) or a variable of the desired window data type. Open places a reference to the open window in windowvar


Parameter The parameter you want to store in the Message object when the window is opened.

Parameter must have one of these data types: ¨String¨ Numeric ¨ PowerObject.


parent (child and popup windows only) (optional)            The window you want make the parent of the child or popup window you are opening. If you open a child or popup window and omit parent, PowerBuilder associates the window being opened with the currently active window


Return value

Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, OpenWithParm returns NULL.





Whet is the difference between pop up and response window?


Child A window that is dependent on a main window and can only exist within the main (parent) window.

Main : A standalone overlapped window that can be independent of all other windows.

MDI : An MDI frame without a MicroHelp status bar.

MDIHelp : An MDI frame with a MicroHelp status bar.

Popup : A window that displays usually in response to an event within a window, but can exist outside of the window and, in some cases, after the window that opened it is closed.

Response : A window that displays to obtain information from the user and cannot lose focus or be closed until the user responds.





Difference between opensheet and open function?


Open: Opens a window object of a known data type. Open displays the window and makes all its properties and controls available to scripts.

Open ( windowvar {, parent } )


OpenSheet : Description

Opens a sheet within an MDI (multiple document interface) frame window and creates a menu item for selecting the sheet on the specified menu.


OpenSheet ( sheetrefvar {, windowtype }, mdiframe {, position {, arrangeopen } } )


Argument Description


Sheetrefvar:      The name of any window variable that is not an MDI frame window. OpenSheet places a reference to the open sheet in  sheetrefvar


windowtype (optional):  A string whose value is the data type of the window you want to open. The data type of windowtype must be the same or a descendant of sheetrefvar


mdiframe :  The name of an MDI frame window


position (optional):   The number of the menu item (in the menu associated with the sheet) to which you want to append the names of the open sheets. Menu bar menu items are numbered from the left, beginning with 1. The default value of 0 lists the open sheets under the next-to-last menu item.


arrangeopen (optional): A value of the ArrangeOpen enumerated data type specifying how you want the sheet arranged in the MDI frame in relation to other sheets when it is opened:¨     Cascaded! — (Default) Cascade the sheet relative to other open sheets, so that its title bar is below the previously opened sheet¨            Layered! — Layer the sheet so that it fills the frame and covers previously opened sheets¨            Original! — Open the sheet in its original size and cascade it



Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, OpenSheet returns NULL.







What is the alternative to store data temporarily?


We can cache the data in the datastore object temporarily.




Define datawindow.


You place DataWindow controls in a window or user object and then specify the DataWindow object you want to use within them to display and manipulate data in the window.


A DataWindow object allows users to display, manipulate, and update database or other information. You build DataWindow objects in the DataWindow painter.


It has five datasource and Eleven Styles to display the data.





What will happen if you write messagebox in itemfocus change event and why?


Message will display once and then nothing will happen because when we loose the focus from one object to other item focus change never triggers.





What are the different type of windows provided in pb?


Child, Main, MDI, MDI help, Popup, Response




What is the difference between pb5 and pb6?





What are the different type of  datawindow object style?


Composite, Compose, Grid, Graph, Crosstab, N-up, Tabular, Freeform, OLE, Label, RichText




What are the events in application objects?


Open, Close,ConnectionBegin,ConnectionEnd,idel,systemerror


Get From The Internet

Good Luck!


About The Author

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments