Search This Blog

Saturday, October 4, 2025

Create a Form Using Python for Save Data into Excel like a Database



#Download Pyhton from here https://www.python.org/downloads/ 

#Download Python:

#Click the “Download Python 3.x.x” button (the latest version).

#Run the Installer:

#Double-click the downloaded .exe file.

#Important: ✅ Check the box that says “Add Python to PATH”.

#Click “Install Now”.

# CMD : python --version

#After installing Python install tkinter  library using below command into CMD 

#    pip install openpyxl

#Write below code into a text book with extension .py

#That's it now dubble click and enjoy


import tkinter as tk

from tkinter import messagebox

import os

from openpyxl import Workbook, load_workbook


# Constants

EXCEL_FILE = "data.xlsx"

HEADERS = ["Name", "Email", "Phone"]


# Function to create Excel file if it doesn't exist

def setup_excel():

    if not os.path.exists(EXCEL_FILE):

        wb = Workbook()

        ws = wb.active

        ws.append(HEADERS)

        wb.save(EXCEL_FILE)


# Function to save data to Excel

def save_data():

    name = name_var.get().strip()

    email = email_var.get().strip()

    phone = phone_var.get().strip()


    if not (name and email and phone):

        messagebox.showerror("Input Error", "All fields are required!")

        return


    wb = load_workbook(EXCEL_FILE)

    ws = wb.active

    ws.append([name, email, phone])

    wb.save(EXCEL_FILE)


    # Clear fields

    name_var.set("")

    email_var.set("")

    phone_var.set("")

    messagebox.showinfo("Success", "Data saved to Excel successfully!")


# GUI setup

setup_excel()

root = tk.Tk()

root.title("Data Entry Form")

root.geometry("300x250")


# Tkinter variables

name_var = tk.StringVar()

email_var = tk.StringVar()

phone_var = tk.StringVar()


# UI Elements

tk.Label(root, text="Enter your details", font=("Helvetica", 14)).pack(pady=10)


tk.Label(root, text="Name").pack()

tk.Entry(root, textvariable=name_var).pack()


tk.Label(root, text="Email").pack()

tk.Entry(root, textvariable=email_var).pack()


tk.Label(root, text="Phone").pack()

tk.Entry(root, textvariable=phone_var).pack()


tk.Button(root, text="Submit", command=save_data).pack(pady=10)


root.mainloop()


Wednesday, June 4, 2025

Error From Interactive Grid - Process ' Process- Save Interactive Grid Data' raised 'ORA-0000: normal, successful completion' while performing row locking.

Error:

Process ' Process- Save Interactive Grid Data' raised 'ORA-0000: normal, successful completion' while performing row locking. This error can occur when the process issues a SELECT FOR UPDATE on a complex view with an instead-of trigger, to lock the row. Set the process attribute 'Lock Row' to No or PL/SQL Code.



Solution:  Go to the Interactive Grid Process properties. Then, Setting > Lock Row > No 


Wednesday, February 26, 2025

Search String Inside Oracle Database Objects SQL

SELECT owner, name, type, line, text 
FROM dba_source
WHERE instr(UPPER(text), UPPER('string')) > 0;

Sunday, February 16, 2025

How to Implement Password Hide/Show in Login Page

Follow these steps to enable users to toggle between hiding and showing their password on the login page.

Step 1: Add the Function and Global Variable

First, you need to add the following JavaScript function and global variable to your login page.

function viewPW() {
   var Vpw = document.getElementById('P9999_PASSWORD'); 
// The password input field
   var VsetIcon = document.getElementById('pwItem'); 
// The icon for toggling visibility

    if (Vpw.type !== 'password') {
        // Hide password: change type to 'password' and show the eye icon
        Vpw.type = 'password';
        VsetIcon.className = 'fa fa-eye pw-item-icon'; // 'eye' icon
    } else {
    // Show password: change type to 'text' and show the 'eye-slash' icon
        Vpw.type = 'text';
        VsetIcon.className = 'fa fa-eye-slash pw-item-icon'; // 'eye-slash' icon
    }
}

Step 2: Add the Inline CSS

Next, insert this inline CSS to style the visibility toggle icon and place it to the right of the password input.

.pw-item-icon {
    float: right;
    margin-left: -30px;
    margin-top: 11px;
    position: relative;
    z-index: 1;
}

Step 3: Add the Toggle Icon to Your Password Input Field

Finally, insert the following HTML code right after your password input field. This code will create the eye icon that the user can click to toggle password visibility.

<span id="pwItem" class="fa fa-eye pw-item-icon" onClick="viewPW()" 
aria-hidden="true"></span>


Saturday, February 15, 2025

Automatic ORDS start / Create a windows service to open a software automatically

Step 1: Create the Batch File

  1. Open a text editor (like Notepad) and add the following code, replacing the path with your Oracle ORDS directory:
@echo off
cd C:\Oracle\app\ords
java -jar ords.war
pause
  1. Save the file with a .bat extension (e.g., start_ords.bat).

Step 2: Test the Batch File

  1. Double-click the .bat file to ensure it starts Oracle ORDS properly.

  2. Once confirmed, move the file to the ORDS installation directory (e.g., C:\Oracle\app\ords).


Step 3: Download NSSM

  1. Go to the following link and download NSSM (Non-Sucking Service Manager) version 2.24:

    NSSM 2.24 Download Link

  2. Extract the contents of the ZIP file to a folder, then move the extracted folder to your C: drive.


Step 4: Install ORDS as a Service

  1. Navigate to the folder where NSSM was extracted (C:\nssm-2.24\win64).

  2. In the file explorer, hold Shift and right-click inside the folder. Select "Open command window here" or "Open PowerShell window here."

  3. In the command prompt, type:

nssm.exe install

Step 5: Configure the Service

  1. In the NSSM window that opens, browse to the .bat file you created earlier.
  2. Set the "Shutdown" option to "None."
  3. Provide a service name (e.g., ORDS_Service) and click "Install."

Step 6: Set the Service to Start Automatically

  1. Open the Services application (press Windows + R, type services.msc, and hit Enter).
  2. Find the service you just created (ORDS_Service), right-click it, and select "Properties."
  3. Set the "Startup type" to "Automatic" and click "OK."

That’s it! ORDS should now start automatically as a service whenever your system restarts.


Let me know if you need any more tweaks or further details!

Thursday, February 13, 2025

Create List from Navigation Menu

 select null      c1_level,

       ENTRY_TEXT     c2_name_for_label,
       ENTRY_TARGET c3_target_url,
       null      c4_is_current,
       ENTRY_IMAGE  c5_icon_name,
       null      c6_icon_attrs,
       null      c7_icon_alt_text,
       null       c8_user_attr1_badge_text
from APEX_APPLICATION_LIST_ENTRIES where LIST_NAME='Desktop Navigation Menu' and APPLICATION_ID=147 and PARENT_ENTRY_TEXT='Tables & Queries';

Saturday, January 25, 2025

Java to Oracle database Connection Using JDBC

Oracle database.
// Java Program to Establish Connection 
// in JDBC with Oracle Database

// Importing database
import java.sql.*;
// Importing required classes
import java.util.*;

// Main class
class Main {

    // Main driver method
    public static void main(String a[])
    {

        // Creating the connection using Oracle DB
        // Note: url syntax is standard, so do grasp
        String url = "jdbc:oracle:thin:@localhost:1521:xe";

        // Username and password to access DB
        // Custom initialization
        String user = "system";
        String pass = "12345";

        // Entering the data
        Scanner k = new Scanner(System.in);

        System.out.println("enter name");
        String name = k.next();

        System.out.println("enter roll no");
        int roll = k.nextInt();

        System.out.println("enter class");
        String cls = k.next();

        // Inserting data using SQL query
        String sql = "insert into student1 values('" + name
                     + "'," + roll + ",'" + cls + "')";

        // Connection class object
        Connection con = null;

        // Try block to check for exceptions
        try {

            // Registering drivers
            DriverManager.registerDriver(
                new oracle.jdbc.OracleDriver());

            // Reference to connection interface
            con = DriverManager.getConnection(url, user,
                                              pass);

            // Creating a statement
            Statement st = con.createStatement();

            // Executing query
            int m = st.executeUpdate(sql);
            if (m == 1)
                System.out.println(
                    "inserted successfully : " + sql);
            else
                System.out.println("insertion failed");

            // Closing the connections
            con.close();
        }

        // Catch block to handle exceptions
        catch (Exception ex) {
            // Display message when exceptions occurs
            System.err.println(ex);
        }
    }
}

Saturday, January 18, 2025

Confirmation Alert Before Submit / Conditional Button execution using one button JavaScript in Oracle Apex

Using below code you can take a confirmation before execution even you can do conditional button press and execution.

apex.message.confirm( "Would you like to submit for approval? Click OK to continue or Cancel to return to the page", function( okPressed ) { if( okPressed ) { if (apex.item("P23_ITEM").isEmpty()) { apex.page.submit( { request: "CREATE" , showWait: true, } ); } else { apex.page.submit( { request: "SAVE" , showWait: true, } ); } } else { // this code will execute if cancel button pressed apex.item("P23_ITEM2").setValue("N"); } });

Friday, January 17, 2025

Interactive Grid Alternating Row Color

1. Put the CSS into Page properties Inline-> 

.customAlternatingRow .a-IRR-table tr:nth-child(odd) td{background-color:#bac3cc}

.customAlternatingRow .a-IRR-table tr:nth-child(even) td{background-color:#dceaf7}

.customRowHighlight .a-IRR-table tr:hover td{background-color:rgba(103,159,214,.55)}


2. Put the below Class code into the Region CSS Class  

customAlternatingRow customRowHighlight


Tuesday, January 14, 2025

Audit Log Sample Trigger

 create or replace TRIGGER "SCHEMA"."UDS_CALL_LOG_INFO_BIU" 

    BEFORE INSERT OR UPDATE 
    ON "APEX_UDS"."UDS_CALL_LOG_INFO"
    FOR EACH ROW
BEGIN
    IF INSERTING THEN
       IF :NEW.MASTER_ID IS NULL THEN
           SELECT UDS_CALL_LOG_INFO_SEQ.NEXTVAL
           INTO :NEW.MASTER_ID
           FROM DUAL;
         END IF;

         :NEW.CREATED_DATE := LOCALTIMESTAMP;
         :NEW.CREATED_BY:=nvl(v('APP_USER'),USER);
    ELSIF UPDATING THEN 
         :NEW.EDIT_DATE := LOCALTIMESTAMP;
         :NEW.EDITED_BY:=nvl(v('APP_USER'),USER);
    END IF;
  EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line ('An error was encountered '||SQLCODE||' -ERROR- '||SQLERRM);
END UDS_CALL_LOG_INFO_BIU;

Monday, December 9, 2024

PDF to Text Covert by Oracle Apex

Here are the steps to convert and get the character into a region by Oracle Apex.


Step1.  Create a page and Copy-Pest the below code into Page  Function and Global Variable Declaration

Saturday, November 30, 2024

Online Oracle Database Live SQL Developer , free SQL/DB (23ai!), no sign-up required

Online Oracle Database and SQL Developer. You can practice Oracle SQL PL/SQL on online SQL Developer for free. Even no sign-up is required. 



Tuesday, September 17, 2024

Check Difference Between Two Database Objects

Step-1. Create Two DBLINK to connect with Two Database then


Step-2.

define logindb=DBLINKONE

define remotedb=DBLINKTWO

define schema_name=SCHEMA_NAME

clear col breaks compute

break on OBJECT_TYPE skip 1 

col src_name format a40

col tgt_name format a40

col object_type format a20

col src_length format 999,999

col tgt_length format 999,999

col diff format 999,999

 

With source_tbl as

(SELECT /*+ MATERIALIZE */ type, name

, standard_hash ( LISTAGG(text, ' ' ON OVERFLOW TRUNCATE) WITHIN GROUP (ORDER BY line) , 'SHA1') hash_value

, sum(length(text)) text_length

, max(line) source_lines

FROM     dba_source@&&logindb

where 1 = 1

and owner = '&&schema_name'

and name not like 'BIN$%'

--and type = 'PROCEDURE'

group by type, name)

, target_tbl as

(SELECT /*+ MATERIALIZE */ type, name

, standard_hash ( LISTAGG(text, ' ' ON OVERFLOW TRUNCATE) WITHIN GROUP (ORDER BY line) , 'SHA1') hash_value

, sum(length(text)) text_length

, max(line) source_lines

FROM     dba_source@&&remotedb

where 1 = 1

and owner = '&&schema_name'

and name not like 'BIN$%'

--and type = 'PROCEDURE'

group by type, name)

select nvl(a.type, b.type) object_type, a.name src_name, b.name tgt_name

, nvl(a.text_length,0) src_length, nvl( b.text_length,0) tgt_length 

, abs ( nvl(a.text_length,0) - nvl(b.text_length,0) )  diff

, GREATEST ( a.source_lines, b.source_lines) max_source_lines

, abs ( a.source_lines -  b.source_lines) diff_source_lines

from source_tbl A full outer join target_tbl B

on (a.name = b.name

    and a.type = b.type)

where 1= 1 

--and (a.hash_value <> b.hash_value

--    or nvl(a.text_length,0) <> nvl(b.text_length,0) )

--objects that are available in both environment

and (a.name is not null and b.name is not null)

and abs ( nvl(a.text_length,0) - nvl(b.text_length,0) ) > 10

order by nvl(a.type, b.type), nvl(a.name, b.name)

Thursday, September 12, 2024

Reorganize Oracle Database Table Column Position Without Recreating Table





Reorganize Column Position Without Recreating Table.

Step_1. 

Create a table:

CREATE TABLE test_table (

    a INT,

    b INT,

    d INT,

    e INT

);


Step_2.

Add a column:

ALTER TABLE test_table  ADD (c INT);


Step_3.

Move the column to the middle:

ALTER TABLE test_table  MODIFY (d INVISIBLE, e INVISIBLE);

ALTER TABLE test_table MODIFY (d VISIBLE, e VISIBLE);


Step_4.

DESCRIBE test_table;

Name

----

A

B

C

D

E

Monday, March 4, 2024

Restrict File Upload by File Type in Oracle Apex

If you want to restrict file upload by file type/extension/format you can follow the below steps. 


Goto File Browser Item --> Advanced --> Custom Attributes 

Then pest below code :

accept=".pdf,.csv,.xlsx"

Here it means only pdf , csv and xlsx file will be acceptable for upload. 


If you want to accept only pdf then you have to put like below code as the screenshot given:

accept=".pdf"


  Double-click on the image to view it on a big screen.


That's it. Now you can go and check. 

Monday, February 12, 2024

Database DML from frontend in Oracle Apex

Application users can able to do DML from the frontend side. 


 1. Create a region and create 7 item like below and a button call Convert 

 

P23_UPDATE_DELETE 

P23_COLUMN_NAME 

P23_CONDITION 

P23_CURRENT_DATE 

P23_UPDATE_COLUMN 

P23_TARGET_DATE 

P23_UPDATE_COUNT 

 

Convert 

 

 

 

2. P23_UPDATE_DELETE  

 

will be a radio group with Update-U and Delete-D 

 

 

 

3. P23_COLUMN_NAME 

 

select  COLUMN_NAME R, COLUMN_NAME D  

from all_tab_columns col 

WHERE  

OWNER='SCHEMA_NAME' AND  

TABLE_NAME='TABLE_NAME' AND  

COLUMN_NAME NOT IN (COLUMNS YOU WANT TO AVOID); 

 

 

 

 

 

4.P23_CONDITION 

 

Select list -> Equals = , Not Equals <> , Is Empty (IS NULL),Is No Empty (IS NOT NULL), Greater Than > , Less Than < , 

Greater Than Equals >=, Less Than Equals <= , IN , NOT IN 

 

 

5. P23_UPDATE_COLUMN 

 

select  COLUMN_NAME R, COLUMN_NAME D  

from all_tab_columns col 

WHERE  

OWNER='SCHEMA_NAME' AND  

TABLE_NAME='TABLE_NAME' AND  

COLUMN_NAME NOT IN (COLUMNS YOU WANT TO AVOID); 

 

 

6. Create a process on the Convert Button 

 

DECLARE 

V_QUERY VARCHAR2(4000):= NULL; 

BEGIN 

 

IF :P23_UPDATE_DELETE='U' THEN  

 

V_QUERY:='UPDATE SCHEMA_NAME.TABLE_NAME SET '||:P23_UPDATE_COLUMN||' = '''||:P23_TARGET_DATE||''' 

WHERE '||:P23_COLUMN_NAME||' '||:P23_CONDITION||'  

'||CASE WHEN UPPER(:P23_CONDITION) ='IS NULL' THEN NULL  

WHEN UPPER(:P23_CONDITION) ='IS NOT NULL' THEN NULL 

WHEN UPPER(:P23_CONDITION) ='IN' THEN '('||:P23_CURRENT_DATE||')' 

WHEN UPPER(:P23_CONDITION) ='NOT IN' THEN '('||:P23_CURRENT_DATE||')' 

WHEN UPPER(:P23_CONDITION) ='BETWEEN' THEN :P23_CURRENT_DATE ||' AND '|| :P23_BETWEEN 

ELSE :P23_CURRENT_DATE END ||'  

AND UPPER(UPLOADED_BY)= '''||UPPER(:APP_USER)||''''; 

 

ELSIF :P23_UPDATE_DELETE='D' THEN  

 

V_QUERY:='DELETE FROM UPDATE SCHEMA_NAME.TABLE_NAME WHERE '||:P23_COLUMN_NAME||' '||:P23_CONDITION||'  

'||CASE WHEN UPPER(:P23_CONDITION) ='IS NULL' THEN NULL  

WHEN UPPER(:P23_CONDITION) ='IS NOT NULL' THEN NULL 

WHEN UPPER(:P23_CONDITION) ='IN' THEN '('||:P23_CURRENT_DATE||')' 

WHEN UPPER(:P23_CONDITION) ='NOT IN' THEN '('||:P23_CURRENT_DATE||')' 

WHEN UPPER(:P23_CONDITION) ='BETWEEN' THEN :P23_CURRENT_DATE ||' AND '|| :P23_BETWEEN 

ELSE :P23_CURRENT_DATE END ||'  

AND UPPER(UPLOADED_BY)= '''||UPPER(:APP_USER)||''''; 

 

END IF ; 

 

 

EXECUTE IMMEDIATE V_QUERY ;  

 

 

IF SQL%ROWCOUNT > 0 THEN 

:P23_UPDATE_COUNT:=SQL%ROWCOUNT||' Records Successfully Updated!'  ; 

ELSE  

:P23_UPDATE_COUNT:=NULL; 

END IF; 

 

END ; 

 

-----> Put it &P23_UPDATE_COUNT.  on Process Success Message 

 

Create a Form Using Python for Save Data into Excel like a Database

#Download Pyhton from here https://www.python.org/downloads/  #Download Python: #Click the “Download Python 3.x.x” button (the latest versio...