Query Help - Add a column that doesn't exist in table
Hello,
i have an application that runs a query in code off of a main query, and that query in code requires a column that does not exist in the main query that I created. how do I go about adding a column to a query that does not actually exist in the table or database that I am querying?
For Example:
SELECT PROJ_ID, PROJECT_NAME
FROM PROJECT
I need a column called "DELETE_SESSION_ID" and this database/table does not contain that column anywhere. Is it best to create a view that creates the column somehow? I would prefer not having to create the column inside of the table. Any ideas are greatly appreciated.
Thanks,
Jeff
user10249614 wrote:
Hello,
i have an application that runs a query in code off of a main query, and that query in code requires a column that does not exist in the main query that I created. how do I go about adding a column to a query that does not actually exist in the table or database that I am querying?
For Example:
SELECT PROJ_ID, PROJECT_NAME
FROM PROJECT
I need a column called "DELETE_SESSION_ID" and this database/table does not contain that column anywhere. Is it best to create a view that creates the column somehow? I would prefer not having to create the column inside of the table. Any ideas are greatly appreciated.
Thanks,
JeffYou need a way to obtain the value you need - a function to generate it, perhaps. A view using such a function or aquiring the value by other means should work well.
Pipelined functions work well to generate values that aren't in the database at run time - if your version of Oracle supports them
Similar Messages
-
Enhancing existing Abap code: using values that doesn't exist in table
Hi,<br><br>
I would like to enhance this code . My requirement is as follows.<br><br>
I have two tables customer and product<br><br>
<pre>KNVP customer master data table
Customer PF Person
700008 YF 45555
700008 YQ 46666
700008 ZF 46666
700008 YM 49999
700008 ZQ 44444
700008 ZM 43333
T179 product hierarchy table*
product hier PF
1000014000 ZM
1000015000 ZF
1000033000 ZQ
The current extractor is showing YM for all YPF values
Customer Zperson ZPF YPF YPerson
700008 46666 ZF YM 49999
700008 43333 ZQ YM 49999
700008 44444 ZM YM 49999</pre>
<br><br>
Case 1:IF customer doesn't have Partner function value YQ in master data then partner function YF person and partner function should be use.
<br><br>
case 2: IF customer doesn't have Partner function value YF in master data then partner function YQ person and partner function should be use.
<br><br>
case3:IF customer doesn't have Partner function value YQ and YF in master data then partner function YM person and partner function should be use.
<br><br>
The tricky part is that YQ doesn't exist in T179 table
<br><br>
<pre>
LOOP AT T_DATA.
ZIDX = SY-TABIX.
CLEAR T179.
Select partner function, assigned to current
product hierarchy level 2
SELECT * FROM T179
WHERE STUFE = '2'
AND PRODH = T_DATA-PRODH.
ENDSELECT.
Replace value with new partner function.
by replacing first letter to 'Y'
CONCATENATE 'Y' T179-ZZPARVW+1(1) INTO NEWPF.
Try to find new sales employee with this new partner function
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = NEWPF.
ENDSELECT.
IF SY-SUBRC EQ 0.
New partner found with this partner function
T_DATA-ZPARVW = NEWPF.
T_DATA-ZPERNR = KNVP-PERNR.
ELSE.
NEWPF = 'YM'.
Try to find new sales employee with partner function 'YM'
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = NEWPF.
ENDSELECT.
T_DATA-ZPARVW = NEWPF.
T_DATA-ZPERNR = KNVP-PERNR.
ENDIF.
MODIFY T_DATA INDEX ZIDX TRANSPORTING ZPARVW ZPERNR.
</pre>
<br><br>Edited by: Matt on Aug 24, 2010 9:31 AM - fixed formattingHi,
thanks for your input, I have written it like this and it is working well for YQ and YF partner functions but YM is not showing when both are missing.
LOOP AT T_DATA.
ZIDX = SY-TABIX.
CLEAR T179.
* Select partner function, assigned to current
* product hierarchy level 2
SELECT * FROM T179
WHERE STUFE = '2'
AND PRODH = T_DATA-PRODH.
ENDSELECT.
* Replace value with new partner function.
* by replacing first letter to 'Y'
CONCATENATE 'Y' T179-ZZPARVW+1(1) INTO NEWPF.
IF SY-SUBRC EQ 0.
IF NEWPF EQ 'YF'.
READ TABLE T_KNVP WITH KEY PARVW = 'YF'.
IF SY-SUBRC EQ 0. "YF exists in master data
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = 'YF'.
ENDSELECT.
T_DATA-ZPARVW = 'YF'.
T_DATA-ZPERNR = KNVP-PERNR.
ELSE.
READ TABLE T_KNVP WITH KEY PARVW = 'YQ'.
IF SY-SUBRC EQ 0. "YQ exists in master data
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = 'YQ'.
ENDSELECT.
T_DATA-ZPARVW = 'YQ'.
T_DATA-ZPERNR = KNVP-PERNR.
ENDIF.
ENDIF.
ENDIF.
IF NEWPF EQ 'YQ'.
READ TABLE T_KNVP WITH KEY PARVW = 'YQ'.
IF SY-SUBRC EQ 0. "YQ exists in master data
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = 'YQ'.
ENDSELECT.
T_DATA-ZPARVW = 'YQ'.
T_DATA-ZPERNR = KNVP-PERNR.
ELSE.
READ TABLE T_KNVP WITH KEY PARVW = 'YF'.
IF SY-SUBRC EQ 0. "YF exists in master data
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = 'YF'.
ENDSELECT.
T_DATA-ZPARVW = 'YF'.
T_DATA-ZPERNR = KNVP-PERNR.
ENDIF.
ENDIF.
ENDIF.
ELSE.
NEWPF = 'YM'.
* Try to find new sales employee with partner function 'YM'
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = NEWPF.
ENDSELECT.
T_DATA-ZPARVW = NEWPF.
T_DATA-ZPERNR = KNVP-PERNR.
ENDIF.
MODIFY T_DATA INDEX ZIDX TRANSPORTING ZPARVW ZPERNR.
ENDLOOP.
thanks
Edited by: Bhat Vaidya on Aug 30, 2010 1:31 PM -
Query to add a column in between existing cols of a table?
HI All,
I have two questions.
1. Query to add a column in between existing cols of a table? (not at the end. This is view of an order of output fields in a report)
2. How do I swap the contents of two columns in a table. Suppose in a table tab there are 2 cols , col1,col2 populated with some data.
I need a query(probably) to swap the col1 and col2 values . NOT AS A RESULT SET, BUT IT NEEDS TO GET CHANGED IN THE TABLE.
Please help !> 1. Query to add a column in between existing cols of
a table? (not at the end. This is view of an order of
output fields in a report)
Not really sensible ito DBMS - it does not care how you want to view the data. The sequence and formats of columns are what you/the application need to specify in the SQL's projection clause.
Also keep in mind to achieve this, the DBMS will need to rewrite the entire table to fit this new column in-between existing columns. This is not the best of ideas.
The projection of rows is dealt with SQL statements - not with the physical storage implementation.
> 2. How do I swap the contents of two columns in a
table. Suppose in a table tab there are 2 cols ,
col1,col2 populated with some data.
I need a query(probably) to swap the col1 and col2
values . NOT AS A RESULT SET, BUT IT NEEDS TO GET
CHANGED IN THE TABLE.
This seems to work:
SQL> create table foo_tab( c1 varchar2(10), c2 varchar2(10) );
Table created.
SQL> insert into foo_tab select TO_CHAR(rownum), TO_CHAR(object_id) from user_objects where rownum < 11;
10 rows created.
SQL> commit;
Commit complete.
SQL> select * from foo_tab;
C1 C2
1 55816
2 55817
3 55818
4 55721
5 105357
6 105358
7 105359
8 105360
9 105361
10 60222
10 rows selected.
SQL> update foo_tab set c1=c2, c2=c1;
10 rows updated.
SQL> select * from foo_tab;
C1 C2
55816 1
55817 2
55818 3
55721 4
105357 5
105358 6
105359 7
105360 8
105361 9
60222 10
10 rows selected.
SQL> -
When I set up my iPhone, I accidentally put in an apple ID that doesn't exist. Therefor, I don't know the password and can't delete my account from iCloud. I was trying to sync my contacts to my iPad and now it's not possible without iCloud on my phone. Can anybody help?
Have you tried changing the admin password in System Preferences > Users & Groups > Password ??
The Apple ID that is associated with your admin password is noted there.
message edited by: cs -
Is it possible to add new columns with format "Text" once a table is linked to a form
Is it possible to add new columns with format "Text" once a table is linked to a form in Numbers for iPhone or is it impossible and thus a serious bug?(Rating stars and numeric vales seem to work.)
Those bugs happen both for new speadsheets as well as existing onces, like the demo. When you are in the form only the numeric keyboard shows up.
Pat from the Apple Store Rosenstrasse/Germany approved that it looks like a Bug during the Numbers Workshop I was in: It is not possible to add new columns with format "Text". I reported the error for Version 1.4 but there is no update nor do I get statement of understanding the issue.Hi Knochenhort,
I see what you are talking about now. Without knowing how the program actually works, I think this is what's going on:
When you add a new column to an already existing table (with already existing formats), the new cells come already formatted like the previous column. So when you add a column to the end of the demo table, the cells are already formatted like stars, and when you add a column to the beginning, they're already formatted like number.
I think this is why it's different when if you add columns to a table with blank (unformatted) columns. In that case, the new cells aren't already "tainted" with a set format, so you can change to text format without issue.
It seems like the problem is that you can't format cells that are already formatted as "number" as "text" format (even if it doesn't look like they are, because they are blank). IMO, this is a bug! This is why you don't see this issue when adding columns to a new table, because the new cells don't already come with a format.
To workaround, you can highlight the body cells after adding the new column, and delete the cells. This will "clear" the formatting, so you can then go in the inspector, format them as text, and the correct keyboard will pop up.
Hope that helps! -
How to deauthorize a computer , that doesn't exist anymore?
I unisnstalled windows , and for some reason when i inserted my ipod to the freshly installed windows+itunes , and logged on my account , iTunes said , that its a new computer and asked me to authorize it , and so i did.
My question is: how can i deauthorize my old version of windows , that doesn't exist anymore?
I also have another question in this topic : When i want to buy items from itunes from a new device , it asks for my bank card number , and takes 1-2 dollars from it. Is this ok?Take a look at this Apple support article; it may help:
One computer using multiple iTunes Store authorizations
When i want to buy items from itunes from a new device , it asks for my bank card number , and takes 1-2 dollars from it. Is this ok?
I'm not sure what you mean by this. What "items"? If you are referring to music, videos or movies, you get only one download per purchase, so if you buy the items again, whether from another device or the same one, yes, you will be charged again. Only apps allow redownloading without additional charge.
Regards. -
Add Audit Columns to the Dimension and Fact tables (Created & modified date Time)
Hi All,
I am new to SSIS , I have to Add Audit Columns to the Dimension and Fact tables (Created & modified date Time) of the package.
Please let me know the best and easy way through which I can implement the same.
If possible suggest some real time example or link where I can find the same
Regards,
Vipin jha
Thankx & regards, Vipin jha MCPYou can simply use ALTER TABLE ADD.. syntax to add the columns if the tables already exist.
You can generate a single script for all tables using INFORMATION_SCHEMA.TABLES view
You can make then of NOT NULL type and set the default value to GETDATE()
In addition you can also have a Audit Trail trigger for UPDATE to make sure Modified date gets updated correctly on each update if not passed explicitly.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Problem creating new sites. The formula refers to a column that does not exist
Good morning,
I have a problem creating new sites in my development environment. We have a template which works properly when we create new sites with it. However, when we add one new content type in the site created and save it as a new template, we can't create new sites
with this template. The error log is that there are one problem in one column [The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column].
I have opened the wsp template with visual studio but I can´t discover what column is the problem because the log only refers to the feature (ListInstances).
Anybody knows how to find my problematic column?
The error is:
Feature Activation: Threw an exception, attempting to roll back. Feature 'plantilla Llave en Mano 20141222 v2ListInstances' (ID: '6c61a3bf-3c51-4064-958b-d154729233e7'). Exception: Microsoft.SharePoint.SPException: La fórmula hace referencia a una
columna que no existe. Compruebe que la fórmula no tiene errores ortográficos o cambie la columna que no existe por otra que exista. ---> System.Runtime.InteropServices.COMException (0x81020057): La fórmula hace referencia a una columna que no existe. Compruebe
que la fórmula no tiene errores ortográficos o cambie la columna que no existe por otra que exista. at Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateField(String bstrUrl, String bstrListName, String bstrXML) at Microsoft.SharePoint.Library.SPRequest.UpdateField(String
bstrUrl, String bstrListName, String bstrXML) --- End of inner exception stack trace --- at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionListInstances(SPFeaturePropertyCollection props, SPSite site,
SPWeb web, Boolean fForce) at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, SPFeatureActivateFlags activateFlags, Boolean
fForce) at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce)
Thanks in advanceHi Enrique,
According to your description, after added a content type into the new site and save the site as a template, there is an issue when creating another new with the newly
site template.
Based on the error message “The formula refers to a column that does not exist…”, seems that it would be an issue of a Calculated column in the content type you added,
please go through all the Calculated column in that content type to see if the formulas all work well.
Feel free to reply if there any progress.
Best regards,
Patrick
Patrick Liang
TechNet Community Support -
Hello, I got a new computer with the old harddisk. Can't play my itunes music because not authorised. Apple ID is very old e-mail adress that doesn't exist anymore and I forgot the password (5 years old??). When chose for secret question birth date seems wrong. Tried everything. I need to make a new apple-id but cannot connect the music that I bought under my old name to my new name. Can't reach anyone!!! Automatic FAQ system is of no help. What to do?
That doesn't help me. For itunes it brings me to the express lane which doesn't help because my case is not in it. It's all standard procedure things. I understand those but my situation is different. The combination of a passport forgotten and an non-existing email adress (and birth dates that are not correct or not accepted). What I need is my password emailed to another email adress than the original one because that no longer exists.
-
I want to update some apps on my iphone but can't because it's asking for an old apple id email that doesn't exist anymore and I have forgotten the password for it!
Help!!!The apple id login is never deleted. The emaill address itself can be disabled or not in use any longer. The apple id login will still be available to you. If you will go to the website My Apple Id
https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
and use the listed apple id login that your apps are asking for to update - once you have changed the password at the lsted website you then will be able to update using the old apple id once you have logged into the device using the old apple id and password.
Good luck. -
iCloud has my old Apple ID and is prompting for a password, but I want to put in the new id, I can't because it is grey and there is no edit option. I'm prompted for a password to an account that doesn't exist. Anyone know what I can do to fix this or why this is happening.? I had no issue putting in my new Apple ID everywhere else, I could sign out of the old and inactive account and then sign back in using my new and proper one. However, after the update to 7.3 it did a whole welcome to yr iPad and a set up thing and it went to set up iCloud and had my old Apple ID in grey where I can't change or edit it, it wants the password, when I put in the old password, it say yr Apple ID is incorrect but yet it won't let me change it??????? Anyone???
Sign out and back into your apple id from Settings>iTunes and App stores>(Your apple ID)>Sign Out and then sign in again with the new address. Close app store from running in the background (or restart the phone if your unsure how to do this). If when trying to update any apps they are still asking for the old apple ID, delete and re-install those apps.
-
How to I get rid of an "Open With..." option that doesn't exist?
I've tried to find out how to remove an element of the "Open With..." options but don't seem to be getting much traction. I have an old application listed in the "Open With..." pull down menu that doesn't exist anymore, but when I select the file, using command-i, to change which application opens the file, it works for that file. I want to change association using the "Change All" button, but when I do that, the "dead" application becomes the default application again and I'm back to square one. Is this fixable? How do I get rid of the useless option? Will I have do do this for each file?
your link gave me a good starting place...
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchSe rvices.framework/Versions/A/Support/lsregister -kill -R -all -domain local -domain system -domain user
this seemed to do the trick... I would have never have solved this without your suggestion.
thanks. -
Paid with a credit card that doesn't exist :S
Hello,
I think I have a problem.
When I first started with Itunes I didn't liked the idea of filling in my creditcard nummer.
I just answerd a number like 12345678 now I thought I already had changed the number into my own credit card so I bought a song.
Later I saw that I bought it with the credit card that doesn't exist...
How can I pay my song now?
MelissaRomania
0800 894847
Contact Apple for support and service
http://www.apple.com/ro/support/
Or try by a chat
https://getsupport.apple.com/Issues.action -
IPhone 5 shows data in Photos that doesn't exist.
iPhone 5 shows data in Photos that doesn't exist.
iPhone 5, 16GB running iOS 8.1.2. Service through Verizon. iCloud Photo Library (Beta) is off. My Photo Stream is off. iCloud photo sharing is off.
Under "About" in settings it says there are 32 Videos and 429 Photos on the device with a capacity of 12.6GB and 7.0GB available.
Normally, I used to import photos and videos from Preview and manually delete them on the phone, until I realized this could also be done in Image Capture with the ability to delete all of them with one click, which is what I did this time (I have done it through Image Capture at least once before).
I've tried in this order: Creating an empty folder and syncing to it through iTunes. That didn't work, so I created a backup on iTunes, completed the "Erase All Content and Settings" option on the phone and then I restored from that backup. Still no luck but I'm wondering if I just saved the issue in the backup and restored back to it. I really don't want to do a complete erase and start over, but if there are no other options I will try it.
Ideas? Thanks in advance.
EDIT: Photo shows iPhone in iTunes after restore.I tried this and it did work for me! It was on a separate posting.
Good luck!
scabthepoetMar 15, 2015 2:00 PM Re: My iPhone 5 camera roll is empty, but under usage says 3.1GB - how can I delete?
Re: My iPhone 5 camera roll is empty, but under usage says 3.1GB - how can I delete?in response to armccoyHelpful
I've been searching for an answer to this very problem for a solid day. Here is what I did that worked for me. No reset. No need to upgrade to more Cloud storage or anything else. I had already deleted out every picture from my phone, including "Messages" and the "recently deleted" album, etc. There really are phantom pictures in there, but the only way to see them and delete them is to:
Go to Settings
Date & Time
Untoggle "Set Automatically"
Manually change the date back. For example, if today is March 15, 2015, choose August 1, 2014. (You can change it back once we're done)
Close out of that
Open "Photos"
Select "Albums"
If, like me, you had already cleared out everything from the Camera Roll and "Recently Deleted" folder, you'll smile to see that your "Recently Deleted" folder now has thousands of images back. Those are your phantom photos
Open it, "Select" and start deleting
Now, go back into Settings - General - Usage - Storage - Manage Storage - and you'll notice your Photo & Camera is empty if you deleted everything
I hope this works for everyone and that I saved you all the time I wasted searching for an answer myself -- only to never find one. Now you have the answer.
I went from barely having any room left on my phone to almost brand new again.
Take care. -
Itunes authorization for an account that doesn't exist?
My new MacBook is asking for an Itunes store authorization for a particular song under an account name that doesn't exist. My apple ID is an old e-mail address; I've already successfully authorized the computer to play songs from that account, into which I can log in with no difficultly. The account name that is supposedly attached to this song is a newer e-mail address (maybe I unsuccessfully tried to change the Apple ID at some point?), but when I click on "forgot password" in the authorization window, it says that the account for which it had prompted me to authorize doesn't exist. Suggestions?
Click here and fill out the form for assistance.
(34501)
Maybe you are looking for
-
Past Seasons Episodes of TV Series
Why to I have to pay to watch last season's episodes on channels that I subscribe to and pay for anyway?! Especially last year's season? This does not seem right. I don't think this is how it was previously?!!
-
MM - Stock Transfer Requirement
Hi Gurus, Is there by any chance a way to use Purchasing Info Record with Stock Transfer Requirement and Stock Transfer Order. I need to use the "minimum purchase quantity" so that my Stock Transfer Order cannot be created below a certain amount of u
-
Exception 'CX_SY_CONVERSION_CODEPAGE '
Hi friends, In one of my bank transfer report i'm getting the runtime error CONVT_CODE_PAGE with the exception CX_SY_CONVERSION_CODEPAGE.I don't what is the reason for this dump and how to correct it.So can anyone of u provide me help on this. I'm at
-
After upgrading from 11.1.0.6 to 11.1.0.7, I get the error: ORA-12541: TNS:no listener. I have attached my tnsnames.ora, listener.ora and my sqlnet.log. I have tried deleting the listener and re-adding it and I get the same error. I have tried adding
-
Transactions across cache regions
Hello, Can a single unit of work (/transaction) be guaranteed to co-ordinate across multiple cache regions (both with and without a CacheStore plugged into the nodes)?