Modification of the PLSQL query
The following query returns the records like below:SELECT
A.CHEQUE_CODE AS COL1,
A.ACC_ADD_REF AS COL2
FROM CTSCHEQUEBOOK A, BRANCHES B, CTSCHEQUEBOOK_DESIGN C
WHERE A.COMP_CODE = 1
AND A.COMP_CODE = B.COMP_CODE
AND A.BRANCH_CODE = B.BRANCH_CODE
AND A.COMP_CODE = C.COMP_CODE
AND A.CHEQUE_CODE = C.CODE
ORDER BY 1
COL1 COL2
---------------------------------
1 01616005034001
1 01616005034001
1 01616005128001
2 01616005197001
2 01616005197001
3 01616005144001
3 01616005144001
3 01616005144001
I want to display the records as only in the column but Group on COL1:1
01616005034001
01616005034001
01616005128001
2
01616005197001
01616005197001
3
01616005144001
01616005144001
01616005144001
How can I do this with my request?
Then try the following script
WITH DATA AS
(SELECT TO_CHAR(A.CHEQUE_CODE) AS COL1,
A.ACC_ADD_REF AS COL2
FROM CTSCHEQUEBOOK A,
BRANCHES B,
CTSCHEQUEBOOK_DESIGN C
WHERE A.COMP_CODE = 1
AND A.COMP_CODE = B.COMP_CODE
AND A.BRANCH_CODE = B.BRANCH_CODE
AND A.COMP_CODE = C.COMP_CODE
AND A.CHEQUE_CODE = C.CODE
ORDER BY 1
)
SELECT
(CASE WHEN RN IS NULL THEN COL1 ELSE COL2 END) COL1
FROM
(SELECT rownum RN,COL1, MIN(COL2) COL2
FROM DATA
GROUP BY CUBE(ROWNUM),COL1);
Mahir
Tags: Database
Similar Questions
-
Dear all,
I have oracle 10 G R2 on windows.
Here's my query: -.
Select a.foliono, a.schcode, sum (a.amount) - sum (b.amount) as Difference_Amount of
processed_tran_split a, systematic_purchase b
where a.folio = b.folio and a.schcode = b.schcode and a.trxntypcod = 'P' and a s = .trxsubtypc ' and
Difference_Amount > 0
A.foliono group, a.schcode
When I run above the query identifier not valid to say "Difference_Amount".
My need is foliono, schcode and processed_tran_split less systematic_purchase amount and the amount that results must be > 0.
Help, please.
Saludos.
CHanchal Wankhade.Modification of the request as below
select a.foliono,a.schcode,sum(a.amount)-sum(b.amount)as Difference_Amount from processed_tran_split a, systematic_purchase b where a.folio=b.folio and a.schcode=b.schcode and a.trxntypcod='P' and a.trxsubtypc='S' and group by a.foliono,a.schcode HAVING sum(a.amount)-sum(b.amount) >0
Concerning
Arun -
My safari has locked up with a request for verification of the property query. What can be done to fix this?
This is the shit that came.
Force Quit Safari (cmd-option-esc) then restart Safari by holding down the SHIFT key.
Sorry, wrong forum... question thought it was an OS X. In any case don't give them any info.
-
When I pull the select query, but therefore cannot get the data that you check?
Hello
When I raised this query without get data then can you help me it's ok?
DataSource { id: durgSearch_dataSource source: "sql/durg.db" query: "select * from durg_detail where durg_name =" + "\"" + searchTextField.text + "\"" onDataLoaded: { durgSearch_dataModel.insertList(data); } }
Glance. I just tested your app and it works correctly. I entered Rock and search button and it returns a Rock record. If you want to get all records that contain a particular letter or Word, you can use the following query:
"select * from medicin_detail where PharmacyName LIKE '%" + searchTextField.text + "%'"
-
Bills of the AP - query gives output in the editor, but no data found when run from a workflow
Hello
I am working on a custom workflow related to invoices from the AP and I came across this very odd situation where the below query works perfectly well by operating in any PL/SQL as Toad/SQL Developer editor but when run in an Oracle Workflow custom, the query raises an exception NO_DATA_FOUND.
I set debugging instructions to capture the values of the parameters (lv_invoice_id and lv_hold_id being retrieved workflow attributes) before and after the SELECT statement and noticed that the values of the parameters are set correctly.
SELECT type
IN lv_match_type
DE ap_invoices_all aia , ap_invoice_lines_all Arnaud , ap_holds_all aha
OÙ ail . invoice_id = lv_invoice_id
ET line_type_lookup_code = "ITEM"
ET AIA . invoice_id = garlic . invoice_id
ET AHA . invoice_id = AIA . invoice_id
ET AHA . hold_id = lv_hold_id
ET ROWNUM = 1 ;
Can anyone suggest what could be wrong with that? Having spent 2 days trying to debug this but without success.
Any help would be greatly appreciated.
I added a function of the WorkflowTimeout JOB just before function which becomes the flag Match, and it worked. It appears like the workflow engine is somehow unable to assign values to the query. Putting a WAIT, he probably gave the workflow a second to assign variables with values. Seems very strange, but seems to have solved the problem. Do thorough tests to confirm that it does not break something else. Mike - appreciate all your help with this post until now. You were very prompt in answering my questions. Appreciate it.
-
query:
Select 'COL ' | column_id | ' AS', column_name | ',' from all_tab_columns
where table_name = 'EMP '.
order of column_id
for the output of the above query, I need to add Select at the beginning and removal of , for the last line of the output of the query so the addition of the EMP at the end of the output of the query
Hello
do you mean like this
select 'SELECT ' || listagg(column_name ||' AS ' || 'COL' || column_id, ', ' || chr(10)) within group (order by column_id) || ' FROM ' || table_name sql from all_tab_columns where table_name='EMP' and owner = 'SCOTT' group by table_name ; SQL -------------------------------------------------------------------------------- SELECT EMPNO AS COL1, ENAME AS COL2, JOB AS COL3, MGR AS COL4, HIREDATE AS COL5, SAL AS COL6, COMM AS COL7, DEPTNO AS COL8 FROM EMP
Where you need this kind of logic?
-
After migrating my APEX 4.1 application to a new environment, one classic report displays a "cannot parse the SQL query: ORA-00942: table or view does not exist" error when the page is displayed. Change the region to report SQL source to somehow (e.g., remove spaces, changing the order of the variables in the WHERE clause) immediately solves the problem, but by returning to the source of the region causes the report error again (the source region valid code without error, however).
Throw the error message:
Select v.id,
v.Col1
of view_vw v
where (: P1_FILTER is null or)
v.col2 = :P1_FILTER)
Do not throw error:
Select v.id,
v.Col1
of view_vw v
where (:P1_FILTER is null or)
v.col2 = :P1_FILTER)
Changing the order of column in the report has the same effect; i.e. He arranges, but return back to the original column order causes the error to display.
It's as if a cached result for the correct select statement used by the report is displayed. However, the application does not use the caching of page/region. Any ideas of what could be the cause?
He solved. Ultimately, all that was necessary was to clear the DB cache using:
alter system flush shared_pool;
-
java.lang.NullPointerException when you click on the search query
java.lang.NullPointerException when you click on the search query:
There is nothing my project involved code...
at oracle.adf.model.binding.DCControlBinding.reportException(DCControlBinding.java:201) at oracle.jbo.uicli.binding.JUCtrlValueBinding.findAttributeDef(JUCtrlValueBinding.java:632) at oracle.jbo.uicli.binding.JUCtrlValueBinding.findAttributeDef(JUCtrlValueBinding.java:597) at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttribute(JUCtrlValueBinding.java:1341) at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfAttributeDescriptor.isRequired(FacesCtrlSearchBinding.java:3018) at oracle.adfinternal.view.faces.renderkit.rich.query.QueryBehavior.shouldShowInstructionText(QueryBehavior.java:66) at oracle.adfinternal.view.faces.renderkit.rich.query.QueryBehavior.refreshInfoFacet(QueryBehavior.java:37) at oracle.adfinternal.view.faces.renderkit.rich.QueryRenderer.renderContentRow(QueryRenderer.java:718) at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer.encodeAll(PanelHeaderRenderer.java:231) at
Cvele_new_account, good point.
Maybe you can try to remove the af: query to the page, and then drop it again.
-
Table error ' can not analyze the SQL query!
Hi all
I created a view on my database called VIEW_MEMBER_PARTIC_PROJECTS
If I run a query showing the results of the view:
SELECT * FROM VIEW_MEMBER_PARTIC_PROJECTS
I get the following data
Projects Participants 1 31 S 2 41 3 19 4 3 5 3 6 1 7 2 Now, I wanted to represent this diagram in the APEX so I created a graphic region and entered the Source query generator and the manufacturer produces the following code
Select null, label projects, value1 Participant link
of "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS ".
With this code, I get an error:
Cannot parse the SQL query!
Select the link null, label projects, value1 "SCHEMANAME Participant." "" VIEW_MEMBER_PARTIC_PROJECTS ".
Some queries can be run when you run your application, if your query is syntactically correct, you can save your query without validation (see options below the source of the query).
The code looks OK, but I do not see to save options as the error code is mentioned.
No one knows how to fix this?
Thank you
JaReg wrote:
I finally found the problem.
I looked at the code for the view and changed the start of:
CREATE OR REPLACE FORCE EDITIONABLE VIEW "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS "("Participant","Projects")
AS
TO
CREATE OR REPLACE VIEW "SCHEMANAME." "" VIEW_REPEAT_PARATIC ".
AS
And that seemed to fix it. I'm not entirely sure why though.
The view was created using the quoted identifiers for column names. This makes them sensitive and means that they must always be referenced using double quotes. In the absence of quotation marks, Oracle is not case insensitive and automatically converts all uppercase identifiers. The application of graph:
Select the link null, label projects, value1 "SCHEMANAME Participant." "" VIEW_MEMBER_PARTIC_PROJECTS ".
has therefore been interpreted by Oracle:
SELECT THE LINK NULL, LABEL, VALUE1 "SCHEMANAME PARTICIPANT PROJECTS." "" VIEW_MEMBER_PARTIC_PROJECTS ".
and PROJECTS and PARTICIPANT columns were not recognized because the columns defined for the view have been 'Participant' and 'projects '. The graphic request should have been:
Select the link null, the label of "Projects", "Participant" value1 "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS ".
As you have now discovered, quoted identifiers are a source of nothing but obscure bugs and should never be used for database objects. He also pointed out the reason why you should always use a standardized, form tiny, coding style as it is faster to type, easy to read and less prone to errors.
-
How to override the default styleClass for the af:query component?
In my entire application, I disabled the labels selectOneChoice and selectOneRadio using the default style class,
TD.af_selectOneChoice_label > label, td.af_selectOneRadio_label > label {}
display: none;
}
Now, for af:query component, I need to display the label. How to replace the above-mentioned styleclass? My version of jdev is 11.1.1.7.0
Try this-
AF | {selectOneChoice::label}
display: none;
}
This hides the label of choice list all except those who are inside the af: query
Ashish
-
Collection of the dynamic query
Hi All-
I'm trying to get the value of the collection through the dynamic query but I am facing some problem please let me know that I hurt.
Created a function like below to run the dynamic query to select statement
create or replace FUNCTION rfunGetColumnValue ( ColumnName VARCHAR2, TableName VARCHAR2, DefaultValue OUT VARCHAR2, Criteria VARCHAR2) RETURN VARCHAR2 IS ReturnValue VARCHAR2 (32767 byte) ; Stmt VARCHAR2 (32767 byte) ; BEGIN stmt := 'begin select '|| ColumnName || ' into :1 from table(:2) ' ||NVL ( Criteria, ' ') || ' Fetch First Row only ; EXCEPTION WHEN OTHERS THEN :2 := SQLERRM; end;' ; dbms_output.put_line (stmt) ; EXECUTE IMMEDIATE stmt USING OUT ReturnValue, OUT DefaultValue; --select Valueinto into Returnvalue from dual; RETURN ReturnValue; END;
Now, I created a folder in the Package
create or replace PACKAGE Collection_PKG is type Bank_rec is RECORD ( SNO NUMBER(10), BANKID NUMBER(5), BANKNAME VARCHAR2(50), BANKSC VARCHAR2(50), ADDEDIT varchar2(1), COMPID number(5), ISBULK number(1), ROWNO number(10), ERROR VARCHAR2(500) ); TYPE Bank_tbl IS TABLE OF Bank_rec; --type Bank_cur is ref cursor return Bank_rec; end Collection_PKG; end Collection_PKG; end Collec tion_PKG;
Now, when I'm Trying the code below
DECLARE V_EXECQUERYPARAM XMLTYPE:= XMLTYPE('<QueryParam> <BankXML> <Bank> <BankID>0</BankID> <BankSC><![CDATA[RCB]]></BankSC> <BankName><![CDATA[Royal challenger Bank]]></BankName> <IsBulk>0</IsBulk> <AddEdit>A</AddEdit> </Bank> </BankXML> </QueryParam>'); BEGIN Rspbanksave( v_SPParamList => V_EXECQUERYPARAM ); END;
create or replace PROCEDURE rspBankSave ( v_SPParamList XMLTYPE DEFAULT NULL) IS V_Addedit VARCHAR2 (1 CHAR) ; Bank_tbl Collection_PKG.BANK_TBL := Collection_PKG.BANK_TBL () ; BEGIN SELECT Row_number () OVER (ORDER BY 1), XT.BankID, XT.BankName, XT.BankSC, XT.AddEdit, v_CompID, XT.IsBulk, CAST (0 AS NUMBER (5)), CASE WHEN MBank.BankID IS NOT NULL THEN CASE WHEN XT.BankSC = MBank.BankSC AND XT.BankName = MBank.BankName THEN 'R104|Entry Already Exist,R114|Short Code Already Exist' WHEN XT.BankSC = MBank.BankSC THEN 'R114|Short Code Already Exist' WHEN XT.BankName = MBank.BankName THEN 'R104|Entry Already Exist' END ELSE NULL END Bulk collect INTO Bank_tbl FROM XMLTABLE ('//QueryParam/BankXML/Bank' PASSING v_SPParamList COLUMNS BankID NUMBER (5) PATH 'BankID', BankName VARCHAR2 ( 50) PATH 'BankName', BankSC VARCHAR2 ( 50) PATH 'BankSC', AddEdit VARCHAR2 ( 1) PATH 'AddEdit', IsBulk NUMBER (1) PATH 'IsBulk') XT LEFT JOIN MBank ON XT.BankID != MBank.BankID AND v_CompID = MBank.CompID AND (XT.BankSC = MBank.BankSC OR XT.BankName = MBank.BankName) ; v_TotalRowCount := SQL%ROWCOUNT; IF (v_TotalRowCount > 0) THEN BEGIN V_Addedit:=rfunGetColumnValue (ColumnName=> 'Upper(AddEdit)',TableName=>'table(Bank_tbl)',DefaultValue=>'',Criteria =>''); END; --SQL Code here END IF; END rspBankSave;
As I've suggested before:
To get the name of the table the column
and as others have:
Type global temporary Tables vs. table
If you give more context, more information about the bigger picture, more information about what you're trying to do and why you're going down the road you go down, you can return more useful information. But you seem reluctant to do.
For the moment, your recent posts seem to just raise the same type of question - why are you doing this?
The normal way to return data to a client is a refcursor.
It is the most effective way.
Not through collections that you seem to be put on the must-do approach.
-
How to avoid the report query needs a unique key to identify each line
Hello
How to avoid the error below
The report query needs a unique key to identify each row. The supplied key cannot be used for this query. Please change the report attributes to define a unique key column.
I have master-detail tables but without constraints, when I created a query as dept, emp table he gave me above the error.
Select d.deptno, e.ename
by d, e emp dept
where e.deptno = d.deptno
Thank you and best regards,
Ashish
Hi mickael,.
Work on interactive report?
You must set the column link (in the attributes report) to something other than "link to display single line." You can set it to 'Exclude the column link' or 'target link to Custom.
-
Problem with cursor Max for the PLSQL called by OAF Page
All,
We developed a custom and Self Service OFA this page page, we call PLSQL package to validate and insert the data into the database tables. It worked well, but when we deployed this form throughout the Organization (meaning more users), we reach the limits of MAX cursor for a session.
This for allows Manager to update all their coordinated under, so in a session, a Manager may work on more than one employee so reach the limit of MAX cursor.
Please help on how we can solve this problem, I checked all of the cursors used in the PLSQL package are closed properly.
Ex PLSQL Call:
String createRow = null;
try {}
OADBTransaction oadbtransaction = (OADBTransaction) pageContext.getApplicationModule (webBean) .getTransaction ();
java.sql.Connection connection = oadbtransaction.getJdbcConnection ();
CallableStatement callablestatement = oadbtransaction.createCallableStatement ("start: 1: = xxx_hr_multiple_rates_pkg.is_create_job_row (pc_job_name = >: 2);") end; ", 1);
callablestatement.setString (2, primaryJob.getText (pageContext));
callablestatement.registerOutParameter(1,Types.VARCHAR);
CallableStatement.Execute ();
createRow = callablestatement.getString (1);
String [] retVals = am.invokeMethod ("createWFMJob", parameter1) (String []);
System.out.println("CreateRow:"+CreateRow);
CallableStatement.Close ();
}
catch (Exception e) {}
e.printStackTrace ();
pageContext.writeDiagnostics (this, try (), 1);
}
Thank you
A
Ankit,
Please attach your PL/SQL code, so that we can have a look that the issue could be in that.
In addition,
Why do you call the code inside this test below? What is the link?
String [] retVals = am.invokeMethod ("createWFMJob", parameter1) (String []);
Why do you need the code below? Delete this.
java.sql.Connection connection = oadbtransaction.getJdbcConnection ();
Move the callablestatement.close (); outside of try catch.
See the link, if you need some examples below:
Advice from the Oracle Johny: OAF: sample code to call the function PL/SQL of OA Framework
See you soon
AJ
-
How to call the <; af:query >; Search feature by clicking on an image?
Hi all
I created a test named and I dragged on my page .jspx as "ADF with Table query Panel. I put the display as 'Simple' Mode in the Properties Inspector, who will hide all the default components of < af:query >. Now I use < af:commandImageLink >. My question is how can I call the < af:query > Search feature when the user clicks on an image? Any suggestion would be appreciated.
Thank U...
If you want to invoke af:query search by program button, follow these steps:
1 Select af:query--> Advanced--> connections and bind it to the back bean
2. in the .jspx add af:link like this:
3 - runQuerySearchAction should be like this:
public String runQuerySearchAction() { QueryDescriptor queryDescriptor = getRichQuery().getValue(); QueryEvent queryEvent = new QueryEvent(getRichQuery(), queryDescriptor); queryEvent.setPhaseId(PhaseId.INVOKE_APPLICATION); getRichQuery().queueEvent(queryEvent); return null; }
-
Hey guys,.
I'm using version 4.2.6 apex. The theme is 26.
IM also using Listener Oracle APEX.
I can print my classic report in PDF or CSV format.
But I need to export it as a .xls extension.
Report type: SQL (body of function from PL/SQL returning the SQL) query
I need is like this cause my 'where' clause type is dynamic.
Look at using this method: Tom's Blog: a non-standard export excel 2010 (.xlsx)
I do something similar for downloads to excel in my projects...
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILL
Maybe you are looking for
-
Hang module 8.0.6001.18702
I was looking for the underlying problem in my computer information storage area and he says a 8.0.6001.18702 grip module is at the origin of the red flags in the region there. Because I have so much trouble with it does not no games on Facebook, and
-
G ' Day,. I'm getting too big for my old 500 GB HARD drive, so I bought a new 1 TB HARD drive. Now I have all of the rescue disks that I made when I first got my laptop Compaq Presario CQ57-105TU . I could use them & fresh install all software & orig
-
In Vista, I am uable to assign Office Word as default program for .doc files. Microsoft Word is not an option. Any ideas? Beginning Default programs Associate a file type or Protocol with a program Highlite .doc and select "change agenda." The prog
-
The loss of mobile data after upgrading to Android 6
I installed the update Android 6 on my Compact Z5 yesterday, and since that time, mobile data no longer works. I tried to restart without result Internet works fine when the wifi is enabled Phone calls work very well, and I have bars full or nearly f
-
BlackBerry smartphones HELP! Automatically REMOVE!
I have a blackberry curve & it's the 2nd time what is happening now! I'm panicked! It removes all my texts, emails, facebooks, Messenger convos and phone records by itself! How can I stop? the 1st time that I called AT & T repeatedly caught in it and