Substr of date as Column name
Hi All,
Can we have substr(date) as column name. I am trying to create a query where in I need to achieve something like this
select s.xyz Today,
s.abcd "6 Months ago" || to_char(add_months(sysdate,-6),'Mon rrrr') ||')'
from sales_tab s
Any idea.
Thanks,
BarbaraBoehmer wrote:
SCOTT@orcl12c> CREATE TABLE sales_tab
2 (xyz NUMBER,
3 abcd NUMBER)
4 /
Table created.
SCOTT@orcl12c> INSERT INTO sales_tab VALUES (1234, 24563)
2 /
1 row created.
SCOTT@orcl12c> VARIABLE g_ref REFCURSOR
SCOTT@orcl12c> DECLARE
2 v_sql VARCHAR2(32767);
3 BEGIN
4 v_sql := 'SELECT xyz "Today",
5 abcd "6 Months ago ('
6 || TO_CHAR (ADD_MONTHS (SYSDATE, -6), 'Mon YYYY')
7 || ')"
8 FROM sales_tab';
9 OPEN :g_ref FOR v_sql;
10 END;
11 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c> PRINT g_ref
Today 6 Months ago (Feb 2013)
1234 24563
1 row selected.
Ok.
Exactly what I was talking about. Creating a customized, date dependent column header in the report.
Similar Messages
-
iam not able to insert data into datagrid corresponding to the column names..as iam inserting both data and column names programatically..ie iam not able to co relate the data with the column names.plzzz help me asap
A DataGrid is row-based rather than cell-based with each row
corresponding to an item in an underlying collection (specified in the
dataProvider property). In order to add data to a DataGrid you
manipulate the underlying collection, rather than the grid directly.
Based on the limited description of your problem I would imagine you
would need to create dynamic objects with property names that correspond
to the dataFields of your dynamically created datagrid columns.
So if you had created columns with dataFields "alpha", "beta" and
"gamma" on your datagrid, you could create an item in your grid by
adding the following object to your dataProvider:
var gridItem : Object = new Object();
gridItem.alpha = "alphaValue";
gridItem.beta = "betaValue";
gridItem.gamma = "gammaValue"; -
Date as column names in a table
SELECT days all_fridays
FROM (
SELECT TO_DATE('0101', 'DDMM') + LEVEL - 1 days
FROM dual CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(TO_DATE('3112', 'DDMM'), 'DDD'))
WHERE to_char(days, 'DY') = 'FRI'Using the above query I'm getting the date's of all 'FRIDAY' day for the current year.
Please help me with a query or pl/sql block that can create a table (t) with these dates as column names.
Also, Can we create a table with dates as column names?
Thank YouWe are all more than welcome to help if you can post your information here. Please don't forget to identify your Oracle version (ex: 10.2.0.4) and post things like the sample data and layout using \ tags (See FAQ for more information on use of tags).
Thanks! -
Hi All. Does anybody know how to get the date of every Friday based on a given quarter and set it as the column name. For instance with quarter 1 the column names would be
1/6/2006
1/13/2006
1/20/2006
1/27/2006
etc
Thank you!Hi,
Try something like :
1 select day# as FRIDAY
2 from
3 (select fist_day_q+rownum-1 day#
4 from
5 (select trunc(sysdate,'q') fist_day_q,
6 last_day(add_months(trunc(sysdate,'q'),2)) last_day_q
7 from dual)
8 connect by level <= last_day_q - fist_day_q +1)
9* where to_char(day#,'d')=5
SQL> /
FRIDAY
06/01/06
13/01/06
20/01/06
27/01/06
03/02/06
10/02/06
17/02/06
24/02/06
03/03/06
10/03/06
17/03/06
FRIDAY
24/03/06
31/03/06
13 rows selected.Nicolas. -
Hi Guys,
The data is like in the format below:
Item ID
COMM
PL
AC
RV
ESTB_ID
1
Q4-2013
Q4-2013
3
2
Q4-2013
Q4-2013
3
12
Q3-2013
Q3-2013
Q4-2013
3
The requirement is to group the data by establishment id and the no of items commissioned, planned, revised and actual in a quarter.
The result set should be like:
ESTB_ID
Item ID
PL Q3-2013
AC Q3-2013
RV Q3-2013
PL Q4-2013
AC Q4-2013
RV Q4-2013
3
1
0
0
0
1
0
1
3
2
0
0
0
1
0
1
3
12
1
0
0
0
1
0
What is the best way of achieving this result?
ThanksTake a look at the links in the FAQ:
Re: 4. How do I convert rows to columns?
Especially: PL/SQL 101 : Cursors and SQL Projection
and How to pipeline a function with a dynamic number of columns? -
Excel 2013 connect to a cube, and Power View concatenate the column name by default
Hi Guys,
Currently, we met a problem with excel services to connect to a cube, when we develope a Excel 2013 Powerview report, the data model column name is concatenate into terrible name by default. e.g. Dim TimeDate Date, Dim TimeTime HierachyYear -Month.
But when start up the data model with Powerpivot, everything gone well. We knew that it can be manual update the name as workaround, but we need to do it every time we create a new powerview with the data model.
Is that any other solution we can do with?
Please help.
JohnnyHi,
As this question is more related to PowerView Report, I suggest you can create a new post in the PowerView forum, you will get more helpful information from there.
PowerView Forum:
https://social.technet.microsoft.com/Forums/en-US/home?forum=powerview
Best Regards
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jerry Guo
TechNet Community Support -
JTable can't display column names and scroll bar in JDialog !!
Dear All ,
My flow of program is JFrame call JDialog.
dialogCopy = new dialogCopyBay(frame, "Bay Name Define", true, Integer.parseInt(txtSourceBay.getText()) ,proVsl ,300 ,300);
dialogCopy.setBounds(0, 0, 300, 300);
dialogCopy.setVisible(true); Then,I set the datasource of JTable is from a TableModel.
It's wild that JTable can diplay the data without column names and scroll bar.
I have no idea what's going wrong.Cause I follow the Sun Tutorial to code.
Here with the code of my JDialog.
Thanks & Best Regards
package com.whl.panel;
import com.whl.vslEditor.vslDefine;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Frame;
import javax.swing.JDialog;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
public class dialogCopyBay extends JDialog {
vslDefine glbVslDefine;
int lvCnt = -1;
JTable tableCopyBay;
int bgnX = 0;
int bgnY = 30;
int tableWidth = 100;
int tableHeight = 100;
public dialogCopyBay(Frame frame, String title, boolean modal, int sourceBay,
vslDefine pVslDefine, int ttlWidth, int ttlHeight) {
super(frame, title, true);
Container contentPane = getContentPane();
System.out.println("dialogCopyBay Constructor");
glbVslDefine = null;
glbVslDefine = pVslDefine;
copyBayModel copyBay = new copyBayModel((glbVslDefine.getVslBayStructure().length - 1),sourceBay);
tableCopyBay = new JTable(copyBay);
tableCopyBay.setPreferredScrollableViewportSize(new Dimension(tableWidth, tableHeight));
JScrollPane scrollPane = new JScrollPane(tableCopyBay);
scrollPane.setViewportView(tableCopyBay) ;
tableCopyBay.setFillsViewportHeight(true);
tableCopyBay.setBounds(bgnX, bgnY, tableWidth, tableHeight);
tableCopyBay.setBounds(10, 10, 100, 200) ;
contentPane.setLayout(null);
contentPane.add(scrollPane);
contentPane.add(tableCopyBay);
class copyBayModel extends AbstractTableModel {
String[] columnNames;
Object[][] dataTarget;
public copyBayModel(int rowNum ,int pSourceBay) {
columnNames = new String[]{"Choose", "Bay Name"};
dataTarget = new Object[rowNum][2];
for (int i = 0; i <= glbVslDefine.getVslBayStructure().length - 1; i++) {
if (pSourceBay != glbVslDefine.getVslBayStructure().getBayName() &&
glbVslDefine.getVslBayStructure()[i].getIsSuperStructure() == 'N') {
lvCnt = lvCnt + 1;
dataTarget[lvCnt][0] = false;
dataTarget[lvCnt][1] = glbVslDefine.getVslBayStructure()[i].getBayName();
System.out.println("lvCnt=" + lvCnt + ",BayName=" + glbVslDefine.getVslBayStructure()[i].getBayName());
public int getRowCount() {
return dataTarget.length;
public int getColumnCount() {
return columnNames.length;
public String getColumnName(int col) {
return columnNames[col];
public Object getValueAt(int rowIndex, int columnIndex) {
return dataTarget[rowIndex][columnIndex];
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
public boolean isCellEditable(int row, int col) {
if (col == 1) {
// Bay Name Not Allow To modify
return false;
} else {
return true;
public void setValueAt(Object value, int row, int col) {
dataTarget[row][col] = value;
fireTableCellUpdated(row, col);Dear DB ,
I am not sure what you mean.
Currently,I don't undestand which code is error.
And I also saw some example is add JTable and JScrollPane in JDialog.
Like Below examle in Sun tutorial
public class ListDialog extends JDialog implements MouseListener, MouseMotionListener{
private static ListDialog dialog;
private static String value = "";
private JList list;
public static void initialize(Component comp,
String[] possibleValues,
String title,
String labelText) {
Frame frame = JOptionPane.getFrameForComponent(comp);
dialog = new ListDialog(frame, possibleValues,
title, labelText);
* Show the initialized dialog. The first argument should
* be null if you want the dialog to come up in the center
* of the screen. Otherwise, the argument should be the
* component on top of which the dialog should appear.
public static String showDialog(Component comp, String initialValue) {
if (dialog != null) {
dialog.setValue(initialValue);
dialog.setLocationRelativeTo(comp);
dialog.setVisible(true);
} else {
System.err.println("ListDialog requires you to call initialize " + "before calling showDialog.");
return value;
private void setValue(String newValue) {
value = newValue;
list.setSelectedValue(value, true);
private ListDialog(Frame frame, Object[] data, String title,
String labelText) {
super(frame, title, true);
//buttons
JButton cancelButton = new JButton("Cancel");
final JButton setButton = new JButton("Set");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ListDialog.dialog.setVisible(false);
setButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ListDialog.value = (String) (list.getSelectedValue());
ListDialog.dialog.setVisible(false);
getRootPane().setDefaultButton(setButton);
//main part of the dialog
list = new JList(data);
list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
list.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
setButton.doClick();
JScrollPane listScroller = new JScrollPane(list);
listScroller.setPreferredSize(new Dimension(250, 80));
//XXX: Must do the following, too, or else the scroller thinks
//XXX: it's taller than it is:
listScroller.setMinimumSize(new Dimension(250, 80));
listScroller.setAlignmentX(LEFT_ALIGNMENT);
//Create a container so that we can add a title around
//the scroll pane. Can't add a title directly to the
//scroll pane because its background would be white.
//Lay out the label and scroll pane from top to button.
JPanel listPane = new JPanel();
listPane.setLayout(new BoxLayout(listPane, BoxLayout.Y_AXIS));
JLabel label = new JLabel(labelText);
label.setLabelFor(list);
listPane.add(label);
listPane.add(Box.createRigidArea(new Dimension(0, 5)));
listPane.add(listScroller);
listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
//Lay out the buttons from left to right.
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(cancelButton);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(setButton);
//Put everything together, using the content pane's BorderLayout.
Container contentPane = getContentPane();
contentPane.add(listPane, BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.SOUTH);
pack();
public void mouseClicked(MouseEvent e) {
System.out.println("Mouse Click");
public void mousePressed(MouseEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
public void mouseReleased(MouseEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
public void mouseEntered(MouseEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
public void mouseExited(MouseEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
public void mouseDragged(MouseEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
public void mouseMoved(MouseEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
* This is here so that you can view ListDialog even if you
* haven't written the code to include it in a program.
} -
I want to display the patameters entered by the user as column names in interactive / classic report.
For example i enter the parameters as date, 10-03-2011, 11-03-2011 and 12-03-2011.
How i can display these dates as column names in report ?
SanjayIn a classic report, set the Headings Type (in the Report Attributes tab) to Custom and set the Heading to
&Px_PARAM1.
&Px_PARAM2.
&Px_PARAM3.
etc... -
Search for columnName and Split data based on that column name
Hi All,
I have a table with one column, lets say Notes of datatype varchar(max).
Source Date:
Notes
ABC:123:XYZ Dept:IT NameID:1 Name:Tom Hummer Date:04/12/2004
456789:CDEF:ADEF
CBD:12/12/2000:ZXCV Dept:HR NameID:1 Name:Sam Dope Date:06/17/2005
I want Output should look like below. It should split data at 'Dept:' and 'Name:' I need SQl code for SQL Server 2008 R2
Output:
Notes
Dept:IT Name:Tom Hummer
Dept:HR Name:Sam Dope
Thanks,
RH
sqlHello,
Please refer to the following statements:
create table notes (note varchar(max));
insert into notes values
('ABC:123:XYZ Dept:IT NameID:1 Name:Tom Hummer Date:04/12/2004'),
('456789:CDEF:ADEF'),
('7890:RST:QWER Dept:Sales NameID:2 Name:Mike Kule'),
('CBD:12/12/2000:ZXCV Dept:HR NameID:1 Name:Sam Dope Date:06/17/2005')
select case
when charindex('Name:',note)>0 and charindex('Date:',note)>0
then SUBSTRING(note,charindex('Name:',note)-1,charindex('Date:',note)-charindex('Name:',note))
when charindex('Name:',note)>0 and charindex('Date:',note)=0
then SUBSTRING(note,charindex('Name:',note)-1,len(note)-charindex('Name:',note))
end as name
from notes
where charindex('Name:',note)>0
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
Reading MS Project column names and data on the fly from a selected View
Hi guys,
I have several views on my project file (MSPROJECT 2010) and I want to build a macro so that;
1. User can select any view ( Views can have diffrent columns and the user may add new columns as well)
2. User runs the Macro and all the coulmns along with the tasks displayed in the view will be written to a excel file. ( I don't want to build several macro's for each view, I'm thinking of a common method which would work for any selected view)
The problem I'm facing is that how will i read the column names and data for a particular view on the fly without hard coding them inside the vba code ?
The solution needs to work on a master schedule as well.
Appreciate your feedback.Just to get you started the following code writes the field name and data for the active task to the Immediate window.
Sub CopyData()
Dim fld As TableField
For Each fld In ActiveProject.TaskTables(ActiveProject.CurrentTable).TableFields
If fld.Field >= 0 Then
Debug.Print Application.FieldConstantToFieldName(fld.Field), ActiveCell.Task.GetField(fld.Field)
End If
Next fld
End Sub
Rod Gill
Author of the one and only Project VBA Book
www.project-systems.co.nz -
Calculation Field to be mapped to different data object's column name in Oracle BAM 12c
Hi,
I am having a challenge to enable drill down to 2nd level report by passing calculation field as parameter.
As an alternative, I am thinking to point calculation field to another data object’s column name and generate report so that I would be able to pass that as parameter to drilling report view.
Is there any way to map calculation field to different Data object’s column name? Thanks in advance.
Regards
Amik Basu1. Yes, you can.
SQL> create table ÜÝÞ( ßàá number(10));
Table created.
SQL> insert into ÜÝÞ values (10);
1 row created.1.1 and 1.2 and 2. You can choose UTF as your default character set. It allows the user of non-English characters in VARCHAR columns in your whole database. It is not per tablespace.
SQL> create table ÜÝÞ( ßàá varchar2(100));
Table created.
SQL> insert into ÜÝÞ values ('âãäçìé');
1 row created. -
How to read the data from an internal table,when column names are known
Hi All
I have a specific requirement. I got an internal table with many fields (let it be my_tab). Some of the fieldnames (column names in internal table my_tab) are stored in separate internal table(let it be my_fields).
I need to store/read data corresponding to the fields (whose name is stored in my_fields) from my_tab.
I am able to build dynamic table (referred by field-symbol) with respect to the given field names in my_fields.
But i am unable to read the data corresponding to the fieldnames from my_tab.
Please provide me some pointer in this regard.
Regards
Swetabh ShuklaHI All
Thanks for the prompt response. I got solution for my question. Please check below thread. For quick reponse i posted my question in one more category. Thanks to all of you.
How to read internal table w.r.t. fieldnames stored in other table -
Generating CSV file with column names and data from the MySQL with JAVA
Hi all,
Give small example on ...
How can I add column names and data to a CSV from from MySQL.
like
example
sequence_no, time_date, col_name, col_name
123, 27-apr-2004, data, data
234, 27-apr-2004, data, data
Pls give small exeample on this.
Thanks & Regards
Rama KrishnaHello Rama Krishna,
Check this code:
Example below exports data from MySQL Select query to CSV file.
testtable structure
CREATE TABLE testtable
(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
text varchar(45) NOT NULL,
price integer not null);
Application takes path of output file as an argument.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class automateExport {
public static void main(String[] args) {
DBase db = new DBase();
Connection conn = db.connect(
"jdbc:mysql://localhost:3306/test","root","caspian");
if (args.length != 1) {
System.out.println(
"Usage: java automateExport [outputfile path] ");
return;
db.exportData(conn,args[0]);
class DBase {
public DBase() {
public Connection connect(String db_connect_str,
String db_userid, String db_password) {
Connection conn;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(db_connect_str,
db_userid, db_password);
} catch(Exception e) {
e.printStackTrace();
conn = null;
return conn;
public void exportData(Connection conn,String filename) {
Statement stmt;
String query;
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
//For comma separated file
query = "SELECT id,text,price into OUTFILE '"+filename+
"' FIELDS TERMINATED BY ',' FROM testtable t";
stmt.executeQuery(query);
} catch(Exception e) {
e.printStackTrace();
stmt = null;
Greetings,
Praveen Gudapati -
Hi everyone, again landed up with a problem.
After trying a lot to do it myself, finally decided to post here..
I have created a form in form builder 6i, in which on clicking a button the data gets exported to excel sheet.
It is working fine with a single table. The problem now is that i am unable to do the same with 2 tables.
Because both the tables have same number of columns & column names.
Below are 2 tables with column names:
Table-1 (MONTHLY_PART_1)
Table-2 (MONTHLY_PART_2)
SL_NO
SL_NO
COMP
COMP
DUE_DATE
DUE_DATE
U-1
U-1
U-2
U-2
U-4
U-4
U-20
U-20
U-25
U-25
Since both the tables have same column names, I'm getting the following error :
Error 402 at line 103, column 4
alias required in SELECT list of cursor to avoid duplicate column names.
So How can i export the data to excel which has 2 tables with same number of columns & column names?
Should i paste the code? Should i post this query in 'SQL and PL/SQL' Forum?
Help me with this please.
Thank You.You'll have to *alias* your columns, not prefix it with the table names:
$[CHE_TEST@asterix1_impl] r
1 declare
2 cursor cData is
3 with data as (
4 select 1 id, 'test1' val1, 'a' val2 from dual
5 union all
6 select 1 id, '1test' val1, 'b' val2 from dual
7 union all
8 select 2 id, 'test2' val1, 'a' val2 from dual
9 union all
10 select 2 id, '2test' val1, 'b' val2 from dual
11 )
12 select a.id, b.id, a.val1, b.val1, a.val2, b.val2
13 from data a, data b
14 where a.id = b.id
15 and a.val2 = 'a'
16 and b.val2 = 'b';
17 begin
18 for rData in cData loop
19 null;
20 end loop;
21* end;
for rData in cData loop
ERROR at line 18:
ORA-06550: line 18, column 3:
PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names
ORA-06550: line 18, column 3:
PL/SQL: Statement ignored
$[CHE_TEST@asterix1_impl] r
1 declare
2 cursor cData is
3 with data as (
4 select 1 id, 'test1' val1, 'a' val2 from dual
5 union all
6 select 1 id, '1test' val1, 'b' val2 from dual
7 union all
8 select 2 id, 'test2' val1, 'a' val2 from dual
9 union all
10 select 2 id, '2test' val1, 'b' val2 from dual
11 )
12 select a.id a_id, b.id b_id, a.val1 a_val1, b.val1 b_val1, a.val2 a_val2, b.val2 b_val2
13 from data a, data b
14 where a.id = b.id
15 and a.val2 = 'a'
16 and b.val2 = 'b';
17 begin
18 for rData in cData loop
19 null;
20 end loop;
21* end;
PL/SQL procedure successfully completed.
cheers -
Im getting an error when running a procedure that includes this code.
I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
DECLARE @retval AS DECIMAL(12,2)
DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
DECLARE @sqlcmd AS NVARCHAR(150)
DECLARE @paramdef NVARCHAR(150)
SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
--default
SET @retval = 0.0;
EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
SELECT @retval
DECLARE @return_value DECIMAL(12,2)
EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
@SpreadKey = 1,
@MonthNumber = 4
SELECT 'Return Value' = @return_value
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
>> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
the shoe size, the phone number or something else at run time of this entity.
In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point.
Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity.
Do you know that SQL is a declarative language? This family of languages does not use local variables!
Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.
Think about how silly this is:
SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental.
We need to see the DDL so we can re-write this mess. Want to fix it or not?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL
Maybe you are looking for
-
Get data from PNPCE LDB in ABAP hr
Hi all, I am workng on ABAP Hr.In it I am using PNPCE LDB, when I use GET PERNR statement it don't give any syntax problem but the selection screen does not generate due to GET PERNR statement. Is there any Other statement to find the PERNR. Points
-
Can't create a digital signature with acrobat 8
We have acrobat 8. My husband has a digital signature but when I try to electronically sign, his digital signature pops up and does not give me the option to create my own. How can I create my own digital signature on this software?
-
IE8 Support for Siebel Analytics 7.8.5
Hi Experts, Currently my company has given me the task to check the issues of IE8 support for Siebel Analytics as they are trying to upgrade IE6 to IE8. So I have the following queries: 1. Will Siebel Analytics 7.8.5 supports IE8? 2. If not, then is
-
I am going to start this by saying that I know very little about technology. That being said, here is my situation: I am studying abroad currently and got a new iPhone 5 slightly before Christmas. When I went abroad I had a foreign SIM card put in so
-
Error while importing the ODI Package from Development to Production Enviroment
Hello Everybody, Currently I'm face the problem when import ODI models (from Development) to Production environment And the error show follwing error: ODI - 23040 Import file "C:/BIAPPS_Package/Models/XyZ.xml" error please help.