Wednesday, March 31, 2021

Ledger report in crystal report

 







--Formula CURRENT_BALANCE

{#RT_OPENING_BALANCE} + IF ISNULL ({#RT_DEBIT}) THEN 0 ELSE {#RT_DEBIT}
 -  IF ISNULL ({#RT_CREDIT}) THEN 0 ELSE {#RT_CREDIT}




Monday, March 29, 2021

How to connect Php to oracle

 This video describes how Oracle 12c database can be connected with PHP using XAMPP.

Pre-requisite:

1) XAMPP installation completed

https://www.apachefriends.org/download.html

2) Instant Client Package Download Link :

https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html

3) C:\instantclient_12_1 Add Path in Environment  Variable 

4) XAMPP Apache -- Config -- PHP.ini

extension=oci8_12c  ; Use with Oracle Database 12c Instant Client

;extension=oci8_19  ; Use with Oracle Database 19 Instant Client


4) C:\xampp\htdocs\test.php

<?php

$conn = oci_connect('test', 'test', 'orcl1', 'AL32UTF8');

if (!$conn) {

$e = oci_error();

trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);

}

Else echo "connection successful";

?>

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

<?php
$conn = oci_connect('system', 'oracle', 'localhost/orcl', 'AL32UTF8');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
Else echo "connection successful";
?>

-----------------------------------------------------------------------------------------------------------------------
Example. oracle.php

<?php
$conn = oci_connect('hr', 'hr', 'orcl1', 'AL32UTF8');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
Else echo "connection successful";
?>




<html>
<head>
</head>
<body>
<h2>Test Results</h2>
<?php
$result =oci_parse($conn, "select department_name from departments");
oci_execute($result);
?>
<ul>
<?php
while ($row =oci_fetch_array($result))
{
?>
<li> <?php echo $row['DEPARTMENT_NAME']; ?> </li>
<?php
?>
</ul>

</body>
</head>
</html>

Saturday, March 27, 2021

Return the checkmark symbol from a formula

 Hi....this comes from the Crystal Knowledgebase artical C2010279

********************************
4. Create a formula similar to the following:
// (xxx) represents the character you want to display
CHR(xxx)
For example:
CHR(254) displays a check box with a check mark in the report and CHR(252) only displays the checkmark without the box in the report.
// CHR(254) - displays a box with a check mark
// CHR(253) - displays a box with an X
// CHR(111) - displays an empty box
// CHR(252) - displays a check mark only
// CHR(251) - displays an X only
5. Insert the formula into the report.
6. Right-click the @CheckBox formula field, and select 'Font'.
7. From 'Font', select 'Wingdings', and click 'OK'.

If ({X_BD_MUL_COMP_REP.MULTI_COM}='FALSE') THEN
Chr(251)
ELSE
Chr(252)


IF({Customers.Registered}='Yes')THEN
Chr(254)
ELSE
Chr(168)

Tuesday, March 23, 2021

Oracle Date Function

select to_char(add_months(to_date((26||'-'||substr('&W2021M02',7,2)||'-'||substr('&W2021M02',2,4)),'DD-MM-RRRR'),-1),'DD-MON-RRRR') 

,to_char(to_date((25||'-'||substr('&W2021M02',7,2)||'-'||substr('&W2021M02',2,4)),'DD-MM-RRRR'),'DD-MON-RRRR') from dual;


to_char(to_date(substr('W2021M02',7,2),'MM'),'Month')||'-'||to_char(to_date(substr('W2021M02',2,4),'RRRR'),'RRRR') MMRR

Friday, March 19, 2021

Oracle Sql Most uses Function

 


ROLLUP (Grand total)


select department_id , sum(salary) 

from hr.employees 

group by rollup(department_id)

//

select department_id ,E.JOB_ID, sum(salary) 

from hr.employees e

group by rollup(department_id,e.job_id)


How to get the employees with their managers


Self -Join

SELECT e.last_name, e.employee_id, m.last_name as manager, e.manager_id, m.last_name,m.employee_id

FROM

    hr.employees  e, hr.employees  m

WHERE e.manager_id = m.employee_id

order by m.employee_id DESC

And if you want to include the president which has no manager then instead of an inner join use an outer join in Oracle syntax:

 inner join 

SELECT e.last_name, e.employee_id, NVL(m.last_name,'No Manager') as manager, e.manager_id, m.last_name,m.employee_id

FROM

    hr.employees  e, hr.employees  m

WHERE e.manager_id = m.employee_id (+)

order by m.employee_id DESC 

ANSI SQL 

SELECT e.last_name, e.employee_id, m.last_name as manager, e.manager_id, m.last_name,m.employee_id

FROM

    hr.employees  e LEFT OUTER JOIN hr.employees  m

on  e.manager_id = m.employee_id

order by m.employee_id DESC


Count All Employees Under Each Manager

SELECT 

sup.employee_id,

    sup.first_name,

    sup.last_name,

    COUNT (sub.employee_id) AS number_of_employees

FROM hr.employees sub 

JOIN hr.employees sup 

ON sub.manager_id = sup.employee_id

GROUP BY sup.employee_id, sup.first_name, sup.last_name; 

Find All Direct Subordinates Under Each Manager

SELECT 

sub.employee_id AS subordinate_id,

    sub.first_name AS subordinate_first_name,

    sub.last_name AS subordinate_last_name,

    sup.employee_id AS superior_id,

    sup.first_name AS superior_first_name,

    sup.last_name AS superior_last_name

FROM hr.employees sub 

JOIN hr.employees sup 

ON sub.manager_id = sup.employee_id

ORDER BY superior_id;



Sunday, March 14, 2021

To set password limit Unlimited in Oracle 11G

When You  tried login your user(TEST) it is showing password will expired with 7 Days.



[oracle@k44-db1]$ sqlplus test/test


SQL*Plus: Release 11.2.0.2.0 Production on Mon Mar 11 22:34:42 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter password: 

ERROR:

ORA-28002: the password will expire within 7 days

Connected to:

Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> 



Get to know which profile the test user is using from dba_users view,


SQL> SELECT profile FROM dba_users WHERE username='TEST';


USERNAME PROFILE

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

TEST     DEFAULT


Now check the password lifetime of the default profile from dba_profiles


SQL> SELECT resource_name,limit FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';


and than set default profile limit to unlimited for below query,


SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;


Profile altered.


after profile limit changed  and Alter user(TEST) password for the below statement,


SQL> alter user test identified by test;


User altered.


after that alter username  and try to connect test user,


[oracle@k44-db1]$ sqlplus test/test


SQL*Plus: Release 11.2.0.3.0 Production on Fri Jul 25 11:50:15 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:


Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

The database is down. Please specify the host credentials to access database restart and diagnostics tools

The database is down. Please specify the host credentials to access database restart and diagnostics tools.

Enterprise manager shows that database is down but in real it is not.

[oracle@grhldb01 trace]$ sqldba


SQL*Plus: Release 11.2.0.3.0 Production on Fri Sep 13 10:38:01 2013


Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options


SQL> select name,open_mode from v$database;


NAME    OPEN_MODE

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

TCHDB   READ WRITE

check the listener status.


[oracle@grhldb01 ~]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 26-AUG-2014 13:16:23


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production

Start Date                13-MAR-2014 12:53:12

Uptime                    165 days 23 hr. 23 min. 10 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      ON

Listener Parameter File   /orabin/grid11gR2/grid/network/admin/listener.ora

Listener Log File         /orabin/grid11gR2/base/diag/tnslsnr/grhldb01/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.128.0.42)(PORT=1521)))

Services Summary...

Service "+ASM" has 1 instance(s).

  Instance "+ASM1", status READY, has 1 handler(s) for this service...

Service "TCHDB" has 2 instance(s).

  Instance "TCHDB1", status READY, has 2 handler(s) for this service...

  Instance "TCHDB2", status READY, has 1 handler(s) for this service...

Service "TCHDB1_RAC" has 1 instance(s).

  Instance "TCHDB2", status READY, has 1 handler(s) for this service...

Service "TCHDB2_RAC" has 1 instance(s).

  Instance "TCHDB2", status READY, has 1 handler(s) for this service...

Service "TCHDBXDB" has 2 instance(s).

  Instance "TCHDB1", status READY, has 1 handler(s) for this service...

  Instance "TCHDB2", status READY, has 1 handler(s) for this service...

Service "TCH_ESP_ORANGE_02_RAC" has 2 instance(s).

  Instance "TCHDB1", status READY, has 2 handler(s) for this service...

  Instance "TCHDB2", status READY, has 1 handler(s) for this service...

Service "TCH_GBR_VODA_02_RAC" has 1 instance(s).

  Instance "TCHDB2", status READY, has 1 handler(s) for this service...

Service "TCH_GBR_VODA_RAC" has 1 instance(s).

  Instance "TCHDB2", status READY, has 1 handler(s) for this service...

The command completed successfully


it’s runing.


Solution:

select username, account_status from dba_users order by 2;

shows that

DBSNMP EXPIRED

SYSMAN EXPIRED

SYSTEM EXPIRED.


if they are locked then simple unlock with commands:

alter user DBSNMP account unlock;

alter user SYSTEM account unlock;

alter user SYSMAN account unlock;

it’s all, now enjoy with enterprise manager


Top 10 Largest Databases in the World

Top 10 Largest Databases in the World

Through your life, you may have come across some very large collections. These collections can vary from things that you use in your day to day life to things such as stones or even bugs. You also might have met with some of the organizations having large databases like Google and Facebook who are nearing to a billion users.


1. The World Data Centre for Climate: 

With a massive 220 terabytes of data, it’s the World Data Centre for Climate (WDCC) who bags the coveted number one spot in our list that features top 10 largest databases across the globe. WDCC, operated by the Max Planck Institute for Meteorology and German Climate Computing Centre, also are the proud owners of a supercomputer worth 35 million Euros. Excluding the 220 terabyte, which are accessible across the web; the WDCC also has an additional 110 terabytes of data that are mainly used for climate simulation and 6 petabytes of extra data’s that are stored in magnetic tapes for easy access. 


2. National Energy Research Scientific computing Center: 

The National Energy Research Scientific Computing Center (NERSC) based in Oakland, California has a unique kind of database that non others can even think of. The NERSC database comprises a mammoth 2.8 petabytes of information that vary from atomic energy research, high energy physics experiments to simulations of our early universe. The NERSC which are owned and operated by the Lawrence Berkeley National Laboratory and the U.S Department of Energy, has the second largest database in the world with a whole lot of information that are handled by a minimum of 2,000 computational scientists. 


3. AT&T: 

One of the oldest telecommunication companies, the American based AT&T has one of the largest databases. The company boasts that they have the largest volume of data in one unique database. Also AT&T has one of the largest database with most number of rows (around 1.9 Trillion), second to Sprint. It’s said that AT&T has been recording the details of callers long before terabytes storing came into market. 


4. Google: 

The giants in internet searching- Google bags the number 4th spot in top 10 largest databases. Although the exact size of Google’s database is unknown, it’s said that Google accounts every single search that makes each day into its database which is around 91 million searches per day. Google stores every search and makes patterns from previous searches so that the user can be easily directed. Google also collects information of their users and stores them as entries in their database which is said to expand over 33 trillion entries. On top of that Google has simply expanded their database with Gmail and Google ads and with their acquisitions like YouTube. 


5. Sprint: 

One of the largest telecommunication providers, Sprint bags the number 5th spot with its immense and ever growing database. One of the largest mobile service providers with around 53 million subscribers, Sprint offers local and long distance land line offerings. It’s said that Sprint’s database records more than 365 million call detail per day. Sprint is also proud owner of the database with most number of insertions. According to reports the database spreads over 2.85 trillion rows. During peak hours, it’s said that this database records around 70,000 calls per second. 


6. LexisNexis: 

If you are unknown to the company LexisNexis, then you are sure to jump from your seats when you hear that the next database once belonged to Choicepoint. A billion page information book, that’s Choicepoint, which was bought by LexisNexis in 2008. This extensive database contains information on around 250 million people of American population. The information varies from addresses, phone numbers, driving records, criminal histories and even DNA data. It’s believed that LexisNexis holds nearly of 250 terabytes of personal data. 


7. Youtube: 

The owners of the largest online video library- YouTube is our number 7 candidate in our top 10 databases across the world. Reports say that about a 100 million videos are watched in YouTube which is about 60% of the overall number of videos watched online. Still the Wall Street Journal in 2006 reported that YouTube’s database features around 45 Terabytes of data. 45 terabytes won’t sound like a large number but when you consider that around 65,000 new videos are being posted daily in YouTube, just think of the database that they now are having. 


8. Amazon: 

With a massive 59 million active customers and more than 42 terabytes of data, it’s Amazon that races itself to the number 8thspot in our top 10 databases. World’s largest retail store, Amazon has huge collection of data that includes general information like phone number and address to receipts and wishlists and any sort of data that the website can extract from its users as they are logged on. It’s said that Amazon has a mass collection of 250,000 full text books which are available online. No wonder Amazon is considered as the world’s largest online community as users can interact and comment virtually on every page of this website. 


9. Central Intelligence Agency (CIA): 

An agency that had been collecting and distributing information’s on people, countries and facts- it’s the Central Intelligence Agency (CIA) who is at the number 9th spot of largest databases across the globe. Although the exact size of the database are yet to be disclosed, it’s believed that the CIA is said to have a massive database as they have been collecting information from both private and public sectors. Parts of this information are available to the public through the Electronic Reading Room and The World Fact Book. Reports say that 100 FOIA (Freedom of Information Act items) are added each month along with statistics on more than 250 countries and their entities which includes information ranging from nuclear developments to the type of beer being used during the Korean War. 


10. Library of Congress: 

Research library of the United States Congress or the de facto national library- it’s the Library of Congress that finds its ideal 10th spot in the listing of top 10 largest databases in the world. Ranging from 130 million items from little story books to newspapers-old and new, and to U.S Government proceedings, the Liberty of Congress (LC) owns a proud collection that not even the digital age can’t match up. It’s said that the text portion of LC would take up of 20 Terabytes of data. With an expansion rate of 10,000 per day, the LC spreads out in a massive 530 miles of shelf space. It’s said that the LC is the ideal place for information’s that aren’t found on the internet. 

Web site link

APEX

 https://tutorialehtml.com/en/marquee-tag-in-html/ 

 https://cloudinary.com/console

http://qaiumer.blogspot.com/2018/05/download-text-file-with-unlimited.html

https://qaiumer.blogspot.com

https://welcometooracle.wordpress.com/2012/10/18/hierarchical/


Saturday, March 13, 2021

Friday, March 12, 2021

The Interview of Oracle DBA

DBA
DG
RAC 
NETWORKING
LINUX 
(DBA)




(DG)





(RAC)




(NETWORKING)




(LINUX)

#What is Linux? Linux® is an open source operating system (OS). An operating system is the software that directly manages a system’s hardware and resources, like CPU, memory, and storage. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.
Think about an OS like a car engine. An engine can run on its own, but it becomes a functional car when it’s connected with a transmission, axles, and wheels. Without the engine running properly, the rest of the car won’t work.

#How does Linux work? Linux was designed to be similar to UNIX, but has evolved to run on a wide variety of hardware from phones to supercomputers. Every Linux-based OS involves the Linux kernel—which manages hardware resources—and a set of software packages that make up the rest of the operating system.

The OS includes some common core components, like the GNU tools, among others. These tools give the user a way to manage the resources provided by the kernel, install additional software, configure performance and security settings, and more. All of these tools bundled together make up the functional operating system. Because Linux is an open source OS, combinations of software can vary between Linux distributions.
#What's a command line? The command line is your direct access to a computer. It's where you ask software to perform hardware actions that point-and-click graphical user interfaces (GUIs) simply can't ask. 

Command lines are available on many operating systems—proprietary or open source. But it’s usually associated with Linux, because both command lines and open source software, together, give users unrestricted access to their computer.

Our latest release of Red Hat® Enterprise Linux comes with even more built-in command line capabilities than ever before and includes consoles that bundle those capabilities in easy-to-use modules that exist off of the command line.

#What is the Linux kernel? The Linux® kernel is the main component of a Linux operating system (OS) and is the core interface between a computer’s hardware and its processes. It communicates between the 2, managing resources as efficiently as possible.

The kernel is so named because—like a seed inside a hard shell—it exists within the OS and controls all the major functions of the hardware, whether it’s a phone, laptop, server, or any other kind of computer.

#What the kernel does? The kernel has 4 jobs:
  1. Memory management: Keep track of how much memory is used to store what, and where
  2. Process management: Determine which processes can use the central processing unit (CPU), when, and for how long
  3. Device drivers: Act as mediator/interpreter between the hardware and processes
  4. System calls and security: Receive requests for service from the processes
#Why choose Red Hat? At Red Hat, Linux is the foundation of everything we do. Red Hat is the second largest corporate contributor to the Linux kernel, bringing with it the experience and expertise of 25 years and a large community of partners, customers, and experts from across the industry. That’s a long relationship, with a history and level of experience that’s hard to come by.
The Linux kernel is open source, and open source is at the core of Red Hat’s values. Learn why we’ve built our company on our conviction that Red Hat® Enterprise Linux is the best.

#What is open source? Open source is a term that originally referred to open source software (OSS). Open source software is code that is designed to be publicly accessible—anyone can see, modify, and distribute the code as they see fit.

Open source software is developed in a decentralized and collaborative way, relying on peer review and community production. Open source software is often cheaper, more flexible, and has more longevity than its proprietary peers because it is developed by communities rather than a single author or company.

Open source has become a movement and a way of working that reaches beyond software production. The open source movement uses the values and decentralized production model of open source software to find new ways to solve problems in their communities and industries.


Monday, March 1, 2021

How to Whole number and Decimal number

 select '123.4512' num, substr('123.4512',1,instr('123.4512','.')-1) wholenum, substr('123.4512',instr('123.4512','.')+1) decimalpart from dual

To generate a PDF using JavaScript in Oracle APEX from a collection

  To generate a PDF using JavaScript in Oracle APEX from a collection, you can follow these steps: 1. Create a button or link on your APEX p...